contact_phone_callback.m

来自「matlab7.0从入门到精通(光盘内容)」· M 代码 · 共 24 行

M
24
字号
function varargout = Contact_Phone_Callback(h, eventdata, handles, varargin)
Current_Phone = get(handles.Contact_Phone,'string');
%如果有一个为空则返回
if isempty(Current_Phone)
    return
end
%在句柄结构体众获取当前地址表
Addresses = handles.Addresses;
Answer=questdlg('Do you want to change the phone number?', ...
    'Change Phone Number', ...
    'Yes','Cancel','Yes');			
switch Answer
case 'Yes'
    % If no name match was found create a new contact
    Addresses(handles.Index).Phone = Current_Phone; 
    handles.Addresses = Addresses;
    guidata(h,handles)
    return			
case 'Cancel'
    %恢复为初始值
    set(handles.Contact_Phone,'String',Addresses(handles.Index).Phone)
    return
en

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?