MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Manuel d'utilisateur Page 262

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 500
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 261
9 Examples of GUIDE UIs
9-16
the Contact_Name_Callback or the Contact_Phone_Callback updates
handles.Addresses.
If you select Save, the save function is called to save the current MAT-file with the new
names and phone numbers.
If you select Save As, a dialog box displays which enables you to select the name of an
existing MAT-file or specify a new file. The dialog box returns the selected file name and
path. The final steps include:
Using fullfile to create a platform-independent path name.
Calling save to save the new data in the MAT-file.
Updating the handles structure to contain the new MAT-file name.
Calling guidata to save the handles structure.
Save_Callback
function Save_Callback(hObject, eventdata, handles, varargin)
% Get the Tag of the menu selected
Tag = get(hObject,'Tag');
% Get the address array
Addresses = handles.Addresses;
% Based on the item selected, take the appropriate action
switch Tag
case 'Save'
% Save to the default addrbook file
File = handles.LastFile;
save(File,'Addresses')
case 'Save_As'
% Allow the user to select the file name to save to
[filename, pathname] = uiputfile( ...
{'*.mat';'*.*'}, ...
'Save as');
% If 'Cancel' was selected then return
if isequal([filename,pathname],[0,0])
return
else
% Construct the full path and save
File = fullfile(pathname,filename);
save(File,'Addresses')
handles.LastFile = File;
Vue de la page 261
1 2 ... 257 258 259 260 261 262 263 264 265 266 267 ... 499 500

Commentaires sur ces manuels

Pas de commentaire