matlab的一个程序,不知道什么问题.
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/14 09:20:38
matlab的一个程序,不知道什么问题.
程序如下:
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
希望哪位大神能够帮忙解决
程序如下:
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
希望哪位大神能够帮忙解决
? Error using ==> set(hline,"linestyle","--")
Error: The input character is not valid in MATLAB statements or expressions.
表示错误,输入的“--”这行命令的变量在matlab声明或表达里面是无效或非法的.换个线型试试
再问: 所有的都是错误的,无论是线性还是其他的,点击其他控件也是错误的
Error: The input character is not valid in MATLAB statements or expressions.
表示错误,输入的“--”这行命令的变量在matlab声明或表达里面是无效或非法的.换个线型试试
再问: 所有的都是错误的,无论是线性还是其他的,点击其他控件也是错误的