[問題] GUI錯誤訊息已回收
>"<小弟在練習GUI程式又遇上困難了,我真的是照書上打的!
我有附上書上的範例程式、我自己寫的程式、keypart程式、錯誤訊息。
版眾一定覺得我很白目,有程式還不會自己對,但是我真的有對啦....
不知道是小弟眼殘還是怎樣真的看不出哪邊有問題。
請版眾幫小弟看看吧!拜託了....我卡關卡好久!>"<
我想要寫一個這樣的程式,簡單的GUI介面,有畫圖功能改變顏色,以及格線開開啟關閉。
http://ppt.cc/nNZE
主要程式碼:
function GUIDraw_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 GUIDraw (see VARARGIN)
% Choose default command line output for GUIDraw
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes GUIDraw wait for user response (see UIRESUME)
% uiwait(handles.figure1);
clear;
close;
clc;
[x,y,z]=peaks;
mesh(x,y,z);
xlabel('X-Axis');
ylabel('Y-Axis');
zlabel('Z-Axis');
title('peaks');
% Set the Accelerator
set (handles.ym,'Accelerator','y');
set (handles.mm,'Accelerator','m');
set (handles.cm,'Accelerator','c');
set (handles.rm,'Accelerator','r');
set (handles.gm,'Accelerator','g');
set (handles.bm,'Accelerator','b');
set (handles.wm,'Accelerator','w');
set (handles.km,'Accelerator','k');
錯誤訊息
??? Reference to a cleared variable handles.
Error in ==> GUIDraw>GUIDraw_OpeningFcn at 74
set (handles.ym,'Accelerator','y');
Error in ==> gui_mainfcn at 221
feval(gui_State.gui_OpeningFcn, gui_hFigure, [], guidata(gui_hFigure), varargin{:});
Error in ==> GUIDraw at 42
gui_mainfcn(gui_State, varargin{:});
我的程式碼
http://rapidshare.de/files/40810407/GUIDraw.m.html
http://rapidshare.de/files/40810538/GUIDraw.fig.html
書上的範例程式
http://rapidshare.de/files/40810464/gui_menu_sample.m.html
http://rapidshare.de/files/40810478/gui_menu_sample.fig.html
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.230.216.178
討論串 (同標題文章)
MATLAB 近期熱門文章
PTT數位生活區 即時熱門文章