MATLAB: Reading string within a string

convertstringstocharsstring

Hello,
Is it possible to do the following:
a='userinput' % string
b={'problem.a', 'problem1.a'…..'problemn.a'}
% fuction/conversion? convertStringsToChars doesnt recognize .a as string!!
I want it to be read as b={'problem.userinput'…..'problemn.userinput'}
Thanks,
Jinang

Best Answer

b={sprintf('problem.%s',a),sprintf('problem1.%s',a)};