5. 雙擊每個元素 .
看此表上註明,並修改其屬性 .
Component HorizontalAlignment String Tag
Top Edit Text right 0 edit1
Bottom Edit Text right 0 edit2
Left Static Text center = text1
Rigth Static Text right 0 result
Push-button center + pushbutton1
10. % --- Executes just before adder is made visible.
function adder_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MLB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to adder (see VARARGIN)
% Choose default command line output for adder
handles.output = hObject;
num = 0;
handles.edit1 = num;
handles.edit2 = num;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes adder wait for user response (see UIRESUME)
% uiwait(handles.figure1);
15. * 編輯回調函數 callback-functions
% --- Executes just before trick2 is made visible.
function trick2_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to trick2 (see VARARGIN)
% Choose default command line output for trick2
handles.output = hObject;
clc
axes(handles.axes1);
bg = imread('trick2_001.jpg');
image(bg);
axis off;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes trick2 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
16. For the callback associated with the push-button, complete it like
this:
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
str = {'I see it clearly... ';
'';
'';
'I have made your card vanish!!'};
set(handles.text1,'String',str);
axes(handles.axes1);
bg = imread('trick2_002.jpg');
image(bg);
axis off;
set(handles.pushbutton1,'Visible','off')