How to concat string + i?
Asked 07 September, 2021
Viewed 449 times
  • 63
Votes
for i=1:N
   f(i) = 'f'+i;
end

gives an error in MatLab. What's the correct syntax to initialize an array with N strings of the pattern fi?

It seems like even this is not working:

for i=1:4
  f(i) = 'f';
end

6 Answer