Changing a word in chart title in loop

Hello everyone,
I am creating 58 graphs in a loop, however I want to change a particular word in the chart title in the loop. That word is saved in a 1x58 cell array i.e. there are 58 names in 58 cells. Therefore, the stock title is ''Global change in 'here I want the names stored in the cell'''. Could anyone help me here?
Thank you in anticipation.

 Accepted Answer

for i=1:58
title("Global change in"+yourCell{i})
end

3 Comments

Thank you Matt for the answer. I wanted to know if the plus sign here is just indicative or it is needed in the code. I mean should it be exactly how you wrote it or it should be like
title ('Global change in yourCell{i}')
Did you try it? We can do so right here.
yourCell={'Temperature','Humidity'};
for i=1:numel(yourCell)
figure(i); plot(1:5)
title("Global change in "+yourCell{i});
end
Thank you Matt for showing this. Its clear now.
Thank you for time.

Sign in to comment.

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Asked:

on 18 Dec 2021

Commented:

on 18 Dec 2021

Community Treasure Hunt

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

Start Hunting!