MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Uživatelská příručka Strana 437

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 759
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 436
Access Workspace Variables from a List Box (GUIDE)
To just inspect the GUI in GUIDE and run it, follow these steps instead:
1 ClickheretoaddtheexamplefilestotheMATLABpath(onlyforthe
current session).
2 Clickheretorunthelb GUI.
3 ClickheretodisplaytheGUIintheGUIDELayoutEditor(readonly).
4 ClickheretodisplaytheGUIcodefileintheMATLABEditor(readonly).
Note Do not save GUI files to the examp les folder where you found them
or you will overwrite the original files. If you want to save G U I files, use
File > Save as from G UIDE, which saves both the GUI FIG-file and the
GUI code file.
Read Workspace Variables
When the GUI initializes, it needs to query the w orkspace variables and s et
the list box
String property to display these variable names. Adding the
following subfunction to the GUI code accomplishes this using
evalin to
execute the
who commandinthebaseworkspace.Thewho command returns a
cell array of strings, which are used to populate the list box.
function update _lis tbox(handles)
vars = evalin('base','who');
set(handles.listbox1,'String',vars)
The function’s input argument is the handles structure set up by the GUIDE.
This structure contains the handle of the list box, as well as the handles of all
other components in the GUI.
The callback for the Up date Listbox push button also calls
update_listbox.
10-63
Zobrazit stránku 436
1 2 ... 432 433 434 435 436 437 438 439 440 441 442 ... 758 759

Komentáře k této Příručce

Žádné komentáře