User`s guide

15 Examples of GUIs Created Programmatically
Note A List Master GUI has no facility to rename itself should someone
replace its contents. You can easily add such a feature; see “Add a “Rename
List” Option to List Master” on page 15-50.
You can import into the GUI text from a cell array in the MA TLAB workspace.
Each element of the cell array should contain a line of text corresponding to a
single list item. For example, you could define a list of grocery items as follows:
groceries = {'1 dozen large eg gs';
'1/2 gallon milk';
'5 lb whole wheat flour';
'1 qt. vanilla ice cream';} ;
If you load the example MAT-file senators11 0con g.mat and display it in the
Variable Editor, you can see it is structured this way. Click here to load this
MAT-fi le and open it in th e Variabl e Editor.
Only use spaces as separators between words in lists . If a list contains tab
characters, the list box does not display them, not even as blanks.
As it exists, you cannot import data from a text file using the List Master
example code as supplied. It does contain a commented-out File menu item
for this purpose and a callback for it (
lmfileimport) containing no code. See
“Add an “Import from File” Option to List Master” on page 15-50 for more
information.
You do not need to import data to work with List Master. The GUI allow s
you to create lists by selecting the Add radio button, typing items in the
edit text box one at a time, and pressing Return to add each one to the list.
You can export any list y ou create.
Export Data from List Master
You can use File > Exp or t list > to wo r kspace to save the current list to
a cell a rray in the MATLAB workspace. The
lmwsexport callback perform s
this operation, calling the
assignin function to create the variable after you
specify its name. If you only want to export a single list item, you can use the
system clipboard, as follows:
15-40