How to update the title with variable string as time evolution

21 ビュー (過去 30 日間)
Zong Hua Chen
Zong Hua Chen 2016 年 12 月 6 日
編集済み: Zong Hua Chen 2016 年 12 月 6 日
How to update the title with variable string as time evolution
figure(1)
hf=surf(x,y,E.^2)
ha=gca
title(['t=',num2str(0)])
xlabel('k_x')
ylabel('K_y')
zlabel('|E|^2')
dt=0.01;
k=1;
while 1
*****
k=k+1;
t=k*dt;
set(hf,'ZData',E.^2)
set(ha,'Title',text(t))
end
The results appear such problems
Error using text
Invalid parameter/value pair arguments
Error in xxxx (line xx)
set(ha,'Title',text(t))

採用された回答

Adam
Adam 2016 年 12 月 6 日
title( ha, sprintf( 't=%f', t ) )
should work
  1 件のコメント
Zong Hua Chen
Zong Hua Chen 2016 年 12 月 6 日
編集済み: Zong Hua Chen 2016 年 12 月 6 日
  • Yes, it work! Really cool!
  • Thank you very very much!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTitle についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by