matlab的一个程序,不知道什么问题。

程序如下:hfigure=figure('name','设置曲线的形状与颜色','menubar','none','numbertitle','off','visible... 程序如下:
hfigure=figure('name','设置曲线的形状与颜色','menubar','none','numbertitle','off','visible','off','position',[200 60 450 450]);
haxes=axes('position',[0.15 0.45 0.7 0.4],'xlim',[0 7],'ylim',[-1 1],'units','normalized');
t=0:0.01:2*pi;
hline=line(t,sin(t),'parent',haxes);
xlabel('自变量x');
ylabel('函数值y');
title('y=sin(x)');
set(0,'defaultuicontrolfontsize',12);
uicontrol('position',[80 40 50 30],'string','实线','callback','set(hline,"linestyle","-")');
uicontrol('position',[190 40 50 30],'string','虚线','callback','set(hline,"linestyle","--")');
uicontrol('position',[300 40 50 30],'string','无线','callback','set(hline,"linestyle","none")');
uicontrol('position',[80 80 50 30],'string','红色','callback','set(hline,"color","r")');
uicontrol('position',[190 80 50 30],'string','绿色','callback','set(hline,"color","g")');
uicontrol('position',[300 80 50 30],'string','蓝色','callback','set(hline,"color","b")');
uicontrol('position',[80 120 50 30],'string','加号','callback','set(hline,"marker","+")');
uicontrol('position',[190 120 50 30],'string','圆圈','callback','set(hline,"marker","o")');
uicontrol('position',[300 120 50 30],'string','星号','callback','set(hline,"marker","*")');
set(hfigure,'visible','on');
错误如下:
??? Error using ==> set(hline,"linestyle","--")
Error: The input character is not valid in MATLAB statements or expressions.

??? Error while evaluating uicontrol Callback
希望哪位大神能够帮忙解决
展开
 我来答
tianxiawulang
2014-02-25 · TA获得超过2.7万个赞
知道大有可为答主
回答量:4732
采纳率:89%
帮助的人:2548万
展开全部

把所有的双引号(")替换成两个单引号('')即可。

hfigure=figure('name','设置曲线的形状与颜色','menubar','none','numbertitle','off','visible','off','position',[200 60 450 450]);
haxes=axes('position',[0.15 0.45 0.7 0.4],'xlim',[0 7],'ylim',[-1 1],'units','normalized');
t=0:0.01:2*pi;
hline=line(t,sin(t),'parent',haxes);
xlabel('自变量x');
ylabel('函数值y');
title('y=sin(x)');
set(0,'defaultuicontrolfontsize',12);
uicontrol('position',[80 40 50 30],'string','实线','callback','set(hline,''linestyle'',''-'')');
uicontrol('position',[190 40 50 30],'string','虚线','callback','set(hline,''linestyle'',''--'')');
uicontrol('position',[300 40 50 30],'string','无线','callback','set(hline,''linestyle'',''none'')');
uicontrol('position',[80 80 50 30],'string','红色','callback','set(hline,''color'',''r'')');
uicontrol('position',[190 80 50 30],'string','绿色','callback','set(hline,''color'',''g'')');
uicontrol('position',[300 80 50 30],'string','蓝色','callback','set(hline,''color'',''b'')');
uicontrol('position',[80 120 50 30],'string','加号','callback','set(hline,''marker'',''+'')');
uicontrol('position',[190 120 50 30],'string','圆圈','callback','set(hline,''marker'',''o'')');
uicontrol('position',[300 120 50 30],'string','星号','callback','set(hline,''marker'',''*'')');
set(hfigure,'visible','on');
608sushe
2014-02-25 · TA获得超过182个赞
知道小有建树答主
回答量:213
采纳率:50%
帮助的人:52.6万
展开全部
??? Error using ==> set(hline,"linestyle","--")
Error: The input character is not valid in MATLAB statements or expressions.
表示错误,输入的“--”这行命令的变量在matlab声明或表达里面是无效或非法的。换个线型试试
追问
所有的都是错误的,无论是线性还是其他的,点击其他控件也是错误的
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

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

类别

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

说明

0/200

提交
取消

辅 助

模 式