Reading string within a string

6 vues (au cours des 30 derniers jours)
jinang patel
jinang patel le 12 Nov 2019
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

Réponse acceptée

David Hill
David Hill le 12 Nov 2019
b={sprintf('problem.%s',a),sprintf('problem1.%s',a)};

Plus de réponses (0)

Catégories

En savoir plus sur Characters and Strings dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by