Create an array of strings

后端 未结 7 1873
走了就别回头了
走了就别回头了 2020-12-15 03:11

Is it possibe to create an array of strings in MATLAB within a for loop?

For example,

for i=1:10
Names(i)=\'Sample Text\';
end

I do

相关标签:
7条回答
  • 2020-12-15 03:47

    You need to use cell-arrays:

    names = cell(10,1);
    for i=1:10
        names{i} = ['Sample Text ' num2str(i)];
    end
    
    0 讨论(0)
提交回复
热议问题