How can I add variables on the plot title

105 ビュー (過去 30 日間)
J Kwon
J Kwon 2022 年 8 月 28 日
コメント済み: Abderrahim. B 2022 年 8 月 28 日
In the code, I use for loop to change my variables(that means the time variation) from 1 to 100.
And I want to add variables on my title to express how the time goes on.
How can I do that thing.
Because I use Matlab 2014b, I can't use any brandnew functions... so I have difficulties.

採用された回答

Abderrahim. B
Abderrahim. B 2022 年 8 月 28 日
Hi!
Pass the for loop index to num2str function then pass this to title. Something like this:
time = 0:1/100:1-1/100 ;
for ii = 1:length(time)
plot( time, ii*time )
title("var" + num2str(ii))
drawnow
end
Hope this helps
  2 件のコメント
J Kwon
J Kwon 2022 年 8 月 28 日
Thank you very much sir. I solved this problem thanks to you.
Abderrahim. B
Abderrahim. B 2022 年 8 月 28 日
My pleasure !

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

製品


リリース

R2014b

Community Treasure Hunt

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

Start Hunting!

Translated by