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 don't seem to be able to do it this way.
You need to use cell-arrays:
names = cell(10,1); for i=1:10 names{i} = ['Sample Text ' num2str(i)]; end
2.1m questions
2.1m answers
60 comments
57.0k users