Save Text as a figure
7 ビュー (過去 30 日間)
古いコメントを表示
Hi
I want to save text in a blank figure box (so I can then save it in postscript format). For example if I had A = 15, B = United Kingdom and C = Green I would want to create a figure that would display
Number of people - 15
Location - United Kingdom
Group - Green
so the figure would display text that would be a combination of manually written text and variables A,B and C
Does anyone know how to do this?
Thanks
Andy
0 件のコメント
採用された回答
Jan
2012 年 4 月 30 日
A = 15;
B = 'United Kingdom';
C = 'Green';
str = sprintf(['Number of people - %d\n', ...
'Location - %s\n', ...
'Group - %s'], A, B, C);
text(0,0, str);
1 件のコメント
Friedrich
2012 年 4 月 30 日
I would add an axis off in addition ;)
One can also use an uicontrol:
A = 15
B = 'UK'
C = 'Green'
h = uicontrol('Style','text',...
'Position',[400 45 120 80],...
'String',sprintf('Number of People %d \n Location %s \n Group %s',A,B,C))
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!