matlab中GUI的问题

全部语句如下(带%的注释都删了functionvarargout=lianxi2delet(varargin)gui_Singleton=1;gui_State=stru... 全部语句如下(带%的注释都删了
function varargout = lianxi2delet(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @lianxi2delet_OpeningFcn, ...
'gui_OutputFcn', @lianxi2delet_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
function lianxi2delet_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
guidata(hObject, handles);
function varargout = lianxi2delet_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;
function edit1_Callback(hObject, eventdata, handles)
a=num2double(get(handles.edit1,'string'));
function edit1_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit2_Callback(hObject, eventdata, handles)
b=num2double(get(handles.edit2,'string'));
function edit2_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function pushbutton1_Callback(hObject, eventdata, handles)
plot(a,b,'r*')
两个文本框中输入坐标,按钮后画出图,请问哪里有错?
展开
 我来答
疾风动竹
2014-10-11 · TA获得超过3.2万个赞
知道大有可为答主
回答量:7695
采纳率:86%
帮助的人:1566万
展开全部
因为a,b不是全局变量,所以把以下两句从edit控件的响应中剪切
a=num2double(get(handles.edit1,'string'));
b=num2double(get(handles.edit2,'string'));

粘贴到pushbutton的响应里

function pushbutton1_Callback(hObject, eventdata, handles)
a=num2double(get(handles.edit1,'string'));
b=num2double(get(handles.edit2,'string'));
plot(a,b,'r*')
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式