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
As already mentioned by Amro, the most concise way to do this is using cell arrays. However, Budo touched on the new string class introduced in version R2016b of MATLAB. Using this new object, you can very easily create an array of strings in a loop as follows:
for i = 1:10
Names(i) = string('Sample Text');
end