MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Manual do Utilizador Página 61

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 500
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 60
Create a Simple UI Programmatically
3-9
Initialize the Simple Programmatic UI
Initialize the UI, so it is ready for the user when the code makes the UI visible. Make
the UI behave properly when it is resized by changing the component and figure units to
normalized. This causes the components to resize when the UI is resized. Normalized
units map the lower-left corner of the figure window to (0,0) and the upper-right corner
to (1.0, 1.0).
Replace this code in editor:
% Make the UI visible.
f.Visible = 'on';
with this code:
% Initialize the UI.
% Change units to normalized so components resize automatically.
f.Units = 'normalized';
ha.Units = 'normalized';
hsurf.Units = 'normalized';
hmesh.Units = 'normalized';
hcontour.Units = 'normalized';
htext.Units = 'normalized';
hpopup.Units = 'normalized';
% Generate the data to plot.
peaks_data = peaks(35);
membrane_data = membrane;
[x,y] = meshgrid(-8:.5:8);
r = sqrt(x.^2+y.^2) + eps;
sinc_data = sin(r)./r;
% Create a plot in the axes.
current_data = peaks_data;
surf(current_data);
% Assign a name to appear in the window title.
f.Name = 'Simple GUI';
% Move the window to the center of the screen.
movegui(f,'center')
% Make the UI visible.
f.Visible = 'on';
Vista de página 60
1 2 ... 56 57 58 59 60 61 62 63 64 65 66 ... 499 500

Comentários a estes Manuais

Sem comentários