How can I add variables on the plot title

조회 수: 107 (최근 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 CenterFile Exchange에서 Loops 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