MATLAB: Combining variables

concatenationdynamically named variablesevalstrings

I have written a code that generates 20 strings (the number actually varies depending on the input), all of which have the names "s_idx_?" where ? is a number from 1 to 20. Is there a command that allows me to concatenate all these strings without having to type out all the names? Thanks.

Best Answer

Don't do it!
but if you have to:
sprintf('s_idx_%i\n',1:20)