MATLAB: How change part of a text in fprintf, title and subtitle

change part of a textfprintfsubtitletitle

Hi all,
I need your help. How one can change as needed part of a text in the fprintf, title and subtitle, and leaving the another one fixed.
I would apprteciate any hint on this. Thx.
Antonio

Best Answer

Just blast over it with the new string. I mean, you put the string in there so somehow you know what you put it. So you could just make up a new string
caption1 = sprintf('This is %d', 10);
title(caption1);
% Now change it.
caption1 = sprintf('This is %d', 99);
title(caption1);
If, for some reason you don't know what's there, then you can retrieve it
existingCaption = get(gca, 'title'); % Or something like that
Then use strfind() or indexing to parse and change the string elements you want changed.
Related Question