string for figure title ignores text after variable
2 ビュー (過去 30 日間)
古いコメントを表示
Robert Demyanovich
2021 年 6 月 10 日
コメント済み: Robert Demyanovich
2021 年 6 月 10 日
I have the following code while creating a figure:
titlestr=sprintf('Time=%6.5f',t(1), 'sec');
title(titlestr);
No error is generated but Matlab won't print the word "sec" after the time, t(1). This code is part of a video so that the user can see the time increasing as Matlab executes code. I'm just trying to put the word "sec" after the time so that viewers know that the time is in seconds and not minutes or hours, etc.
0 件のコメント
採用された回答
the cyclist
2021 年 6 月 10 日
編集済み: the cyclist
2021 年 6 月 10 日
Write it as one string, with the variable in the midst of it"
t = 8.2;
titlestr=sprintf('Time=%6.5f sec',t(1));
title(titlestr);
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Title についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!