24小时热门版块排行榜    

查看: 1547  |  回复: 11
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

xuliumin

金虫 (正式写手)

[求助] matlab代码保存图片出现问题,请大牛帮忙已有1人参与

clc
clear

x=1:100;
y=x.^2+3;
figure,H=plot(x,y,x,2*y);
set(H,'Linestyle','*','Linewidth',1.5);
xlabel('X'); ylabel('Y');
legend('A Figure!')
saveas (H,'H.fig')


报错:
Operands to the || and && operators must be convertible to logical scalar values.

Error in saveas (line 64)
    while ~isempty(h) &&  ~isfigure(h)

Error in experiment (line 10)
saveas (H,'H.fig')

>>


大牛,HELP!!
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

xuliumin

金虫 (正式写手)

引用回帖:
2楼: Originally posted by FMStation at 2016-09-24 18:56:53
GUI Alternative

Use File > Save As on the figure window menu to access the Save As dialog, in which you can select a graphics format.

I know this method, but I prefer a way using code.
3楼2016-09-24 19:08:58
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 12 个回答

FMStation

至尊木虫 (知名作家)

【答案】应助回帖

感谢参与,应助指数 +1
GUI Alternative

Use File > Save As on the figure window menu to access the Save As dialog, in which you can select a graphics format.
2楼2016-09-24 18:56:53
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

FMStation

至尊木虫 (知名作家)

【答案】应助回帖

https://www.mathworks.com/matlabcentral/answers/43583-how-to-save-the-plot-with-two-lines

Error Version
CODE:
x=rand(1,10);
y=1:10;
h=plot(x,y,'r',x,y,'g');
saveas(h, 'test','jpg');

Correct version
CODE:
h=figure;
x=rand(1,10);
y=1:10;
plot(x,y,'r',x,y,'g');
saveas(h, 'test','jpg');

4楼2016-09-24 19:18:31
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

xuliumin

金虫 (正式写手)

引用回帖:
4楼: Originally posted by FMStation at 2016-09-24 19:18:31
https://www.mathworks.com/matlabcentral/answers/43583-how-to-save-the-plot-with-two-lines

Error Version

x=rand(1,10);
y=1:10;
h=plot(x,y,'r',x,y,'g');
saveas(h, 'test','jpg');


Correct v ...

你好,非常感谢你的回帖。只是我现在又出现了一个问题。
clc
clear
h=figure;
x=rand(1,10);
y=1:10;
plot(x,y,'r',x,y,'g');
set(h,'Linewidth',1.5)
saveas(h, 'test','jpg');


当给其加线宽时就报错。是怎么回事啊
5楼2016-09-24 20:56:35
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
信息提示
请填处理意见