MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Instrukcja Użytkownika Strona 259

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 330
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 258
An Address Book Reader
10-35
& the second element is a MATLAB file, then load that file
elseif (length(varargin) == 2 && ...
strcmpi(varargin{1},'book') && ...
(2 == exist(varargin{2},'file')))
Check_And_Load(varargin{2},handles);
else
errordlg('File Not Found','File Load Error')
set(handles.Contact_Name,'String','')
set(handles.Contact_Phone,'String','')
end
Loading an Address Book Into the Reader
There are two ways in which an address book (i.e., a MAT-file) is loaded into
the GUI:
When running the GUI, you can specify a MAT-file as an argument. If you
do not specify an argument, the GUI loads the default address book
(
addrbook.mat).
The user can select
Open under the File menu to browse for other MAT-files.
Validating the MAT-file
To be a valid address book, the MAT-file must contain a structure called
Addresses that has two fields called Name and Phone. The Check_And_Load
subfunction validates and loads the data with the following steps:
Loads (
load) the specified file or the default if none is specified.
Determines if the MAT-file is a valid address book.
Displays the data if it is valid. If it is not valid, displays an error dialog
(
errordlg).
Returns
1 for valid MAT-files and 0 if invalid (used by the Open menu
callback)
Saves the following items in the
handles structure:
- The name of the MAT-file
- The
Addresses structure
- An index pointer indicating which name and phone number are currently
displayed
Przeglądanie stron 258
1 2 ... 254 255 256 257 258 259 260 261 262 263 264 ... 329 330

Komentarze do niniejszej Instrukcji

Brak uwag