Textbox locations on a MATLAB figure

22 ビュー (過去 30 日間)
Owen Cheevers
Owen Cheevers 2022 年 7 月 18 日
コメント済み: Owen Cheevers 2022 年 7 月 19 日
I've been trying to add little textboxes with some variable values onto my graphs, like so in the bottom left and right corners:
And thus far, I've just been sort of guessing and checking on the coordinates for where to place the textboxes to get them in the bottom corners, is there a better/ more efficient way to do this that anyone knows of?

回答 (1 件)

Image Analyst
Image Analyst 2022 年 7 月 18 日
It might be easier if you use normalized units. Are you using GUIDE or App Designer?
  3 件のコメント
Image Analyst
Image Analyst 2022 年 7 月 18 日
Then how did you make your GUI? Did you do it programmatically (the hard way)?
Owen Cheevers
Owen Cheevers 2022 年 7 月 19 日
Please forgive my ignorance, but I'm not quite sure I know what you're referring by GUI. Are you referring to the textboxes that I placed on the figure?
If so, I used something like the following code:
figure(1)
% going to re-define the parameter values here, just for clarity.
N = 1000; g = 0.5; b = 10; MaxS = 150000; t_out = 500;
dim = [0, 0.01, 0.05, 0.05];
str = 'N = ' + string(N) + ', g = ' + string(g) + ', b = ' ...
+ string(b);
annotation('textbox', dim, 'String', str, 'FitBoxToText', 'on')
dim = [0.7, 0.01, 0.05, 0.05];
str = 'MaxS = ' + string(MaxS) + ', t_o_u_t = ' + string(t_out);
annotation('textbox', dim, 'String', str, 'FitBoxToText', 'on')

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

カテゴリ

Help Center および File ExchangeGraphics Object Properties についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by