How to display constant with caption in separate window
12 ビュー (過去 30 日間)
古いコメントを表示
So I have this function:
save('LenaInitial.txt','SaveMatr');
s = dir('LenaInitial.txt');
filesizeini = s.bytes;
And I need to display filesizeini with some caption in separate window. Functions like disp or text are not suitable.
2 件のコメント
Adam Danz
2019 年 6 月 3 日
Are you displaying this text in a figure? in the command window? in a text field within an app?
And why aren't disp and text() suitable?
採用された回答
Adam Danz
2019 年 6 月 3 日
編集済み: Adam Danz
2019 年 6 月 3 日
You can only plot text on axes (not on the figure background). However, the axes can be invisible so it appears as if the text is on the figure. Here's a demo.
fh = figure();
% add axis to bottom, left corner
ah = axes(fh,'position',[0,0,.3,.1]);
% add text
x.bytes = 9000;
filesizeini = s.bytes;
textStr = sprintf('filesize = %d bytes', s.bytes);
text(ah,.2,.2,textStr,'HorizontalAlignment', 'left', 'VerticalAlignment', 'bottom')
% Turn off axis
ah.Visible = 'off';
Note that can combine the last line of code with the axes() line like this :
ah = axes(fh,'position',[0,0,.3,.1],'Visible','off');
6 件のコメント
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Interactive Control and Callbacks についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!