Move message box to specific location

27 visualizaciones (últimos 30 días)
Elysi Cochin
Elysi Cochin el 2 de Mzo. de 2023
Respondida: David Mattox el 24 de Mayo de 2023
Is it possible to display the message box in specified location, like legend location - north, south, east, west northeast ... ?
Or is it possible only by specifying the 'Position' as [30 30 120 35]
I have 9 message boxes. So it would be better if I could place the message boxes in 9 positions through code

Respuesta aceptada

David Mattox
David Mattox el 24 de Mayo de 2023
Same question... Found the answer.
CODE:
hfmb = msgbox(sprintf('Max data boundaries:\n\t%9.2f < X <%9.2f\n\t%9.2f < Y <%9.2f\n\t%9.2f < Z <%9.2f\n',-4,4,-10,8,15,26),'Query Boundary','warn','warn');
set(hfmb,'position',[231.5000 660.1667 197 97.2500])
If I recall, position is [Left Bottom Width Height]

Más respuestas (1)

Dyuman Joshi
Dyuman Joshi el 2 de Mzo. de 2023
Editada: Dyuman Joshi el 2 de Mzo. de 2023
You can use annotation to make Text-boxes.
x=0:0.01:10;
y=5*sin(x);
plot(x,y)
%dimension refers to size and the location of the box
dim = [0.15 0.15 0.25 0.05];
%the values correspond to [starting_x starting_y length height]
%The default units are normalized to the figure, uipanel or uitab, i.e.
%bottom left is (0,0) and top right is (1,1)
str = {'This is a sine curve'};
annotation('textbox', dim, 'String', str, 'FontSize', 8, 'FitBoxtoText', 'off')
%go through the documentation for more features

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by