概述
如果是以下代码:
hf=figure('position',[200 200 600 400],...
'name','gui_hd','numbertitle','off');
ha=axes('position',[0.4 0.1 0.5 0.7],'box','on');
hbsin=uicontrol(hf,'style','pushbutton','position',[50 140 100 30],'string','plot sin(x)','callback',...
['x=0:0.1:4*pi;' 'plot(x,sin(x));' 'axis([0 4*pi -1 1]);']);
hbcos=uicontrol(hf,'style','pushbutton','position',[50 100 100 30],'string','plot cos(x)','callback',...
['x=0:0.1:4*pi;' 'plot(x,cos(x));' 'axis([0 4*pi -1 1]);'])
显示运行正常。
但是我想在绘制图形的时候加上xlabel('x'),ylabel('y')
编制如下代码:
hf=figure('position',[200 200 600 400],...
'name','gui_hd','numbertitle','off');
ha=axes('position',[0.4 0.1 0.5 0.7],'box','on');
hbsin=uicontrol(hf,'style','pushbutton','position',[50 140 100 30],'string','plot sin(x)','callback',...
['x=0:0.1:4*pi;' 'plot(x,sin(x));' 'axis([0 4*pi -1 1]);' 'xlabel(ha,'x'); ' 'ylabel(ha,'y');']);
hbcos=uicontrol(hf,'style','pushbutton','position',[50 100 100 30],'string','plot cos(x)','callback',...
['x=0:0.1:4*pi;' 'plot(x,cos(x));' 'axis([0 4*pi -1 1]);' 'xlabel(ha,'x'); ' 'ylabel(ha,'y');'])
运行就出问题了,错误提示如下:??? ['x=0:0.1:4*pi;' 'plot(x,sin(x));' 'axis([0 4*pi -1 1]);' ' xlabel(ha,'x');' 'ylabel(ha,'y')']);
|
Error: Missing MATLAB operator.
我猜想是xlabel与ylabel中单引号''配对出现了问题,因为添加的时候,不是正常的蓝色,而是黑色的,可不知道怎么去解决。
[本帖最后由 edifiers2008 于 2008-12-22 17:57 编辑]
最后
以上就是害怕烤鸡为你收集整理的xlabel 用法 matlab,matlab关于使用m语言设计gui设置xlabel出错的全部内容,希望文章能够帮你解决xlabel 用法 matlab,matlab关于使用m语言设计gui设置xlabel出错所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复