Specifications

An Address Book Reader
5-45
(uigetfile) that enables the user to browser for files. The dialog displays only
MAT-files, but users can change the filter to display all files.
The dialog returns both the filename and the path to the file, which is then
passed to
fullfile to ensure the path is properly constructed for any platform.
Check_And_Load validates and load the new address book.
Open_Callback Code Listing
function varargout = Open_Callback(h, eventdata, handles, varargin)
[filename, pathname] = uigetfile( ...
{'*.mat', 'All MAT-Files (*.mat)'; ...
'*.*','All Files (*.*)'}, ...
'Select Address Book');
% If "Cancel" is selected then return
if isequal([filename,pathname],[0,0])
return
% Otherwise construct the fullfilename and Check and load the file
else
File = fullfile(pathname,filename);
% if the MAT-file is not valid, do not save the name
if Check_And_Load(File,handles)
handles.LastFIle = File;
guidata(h,handles)
end
end
See the Menu Editor section for information on creating the menu.
The Contact Name Callback
The Contact Name text box displays the name of the address book entry. If you
type in a new name and press enter, the callback performs these steps:
If the name exists in the current address book, the corresponding phone
number is displayed.
If the name does not exist, a question dialog (
questdlg) asks you if you want
to create a new entry or cancel and return to the name previously displayed.
If you create a new entry, you must save the MAT-file with the
File -> Save
menu.