24小时热门版块排行榜    

北京石油化工学院2026年研究生招生接收调剂公告
查看: 1730  |  回复: 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的回帖

FMStation

兑换贵宾

优秀!!有木有!!!优秀!!有木有!!!优秀!!有木有!!!优秀!!有木有!!!

【答案】应助回帖

★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★
xuliumin: 金币+50, ★★★很有帮助, 不是很理解程序。但是程序确实可行。Thank you! 2016-09-25 00:11:59
CODE:
clc
clear
h=figure;
x=rand(1,10);
y=1:10;
h2=plot(x,y,'r',x,y,'g');
set(h2, 'LineWidth', 1.5)
saveas(h, 'test','jpg');

6楼2016-09-24 21:14:07
已阅   回复此楼   关注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的回帖

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的回帖

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的回帖
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 288求调剂 一志愿哈工大 材料与化工 +19 洛神哥哥 2026-03-31 19/950 2026-04-01 01:35 by 1018329917
[考研] 311(085601)求调剂 +12 liziyeyeye 2026-03-28 13/650 2026-04-01 00:34 by fmesaito
[考研] 359求调剂 +7 邓邓邓书书 2026-03-25 7/350 2026-03-31 23:15 by fs26jie
[考研] 070300化学专业279调剂 +10 哈哈哈^_^ 2026-03-31 10/500 2026-03-31 23:13 by liu823948201
[考研] 调剂推荐 +7 清酒714 2026-03-26 8/400 2026-03-31 22:12 by 544594351
[考研] 0856材料化工调剂 总分330 +17 zhubinhao 2026-03-27 17/850 2026-03-31 18:56 by 小张做实验
[考研] 285求调剂 +3 FZAC123 2026-03-30 3/150 2026-03-31 17:49 by 热情沙漠
[考研] 329求调剂,一志愿西北工业大学,材料工程(085601) +6 小小机灵虫 2026-03-29 12/600 2026-03-31 16:58 by 记事本2026
[考研] 340求调剂 +4 希望如此i 2026-03-31 4/200 2026-03-31 16:40 by 690616278
[考研] 085601 材料工程 313分 求调剂 +6 Ong3 2026-03-27 6/300 2026-03-31 15:18 by yanflower7133
[考研] 生物学 296 求调剂 +7 朵朵- 2026-03-26 9/450 2026-03-31 14:26 by jp9609
[考研] 抱歉 +3 田洪有 2026-03-30 3/150 2026-03-30 19:11 by 迷糊CCPs
[考研] 295求调剂 +5 wei-5 2026-03-26 5/250 2026-03-30 08:34 by 探123
[考研] 305求调剂 +8 RuiFairyrui 2026-03-28 8/400 2026-03-29 08:22 by fmesaito
[考研] 295求调剂 +5 1428151015 2026-03-27 6/300 2026-03-28 04:04 by fmesaito
[有机交流] 高温高压反应求助 10+4 chibby 2026-03-25 4/200 2026-03-27 21:08 by BT20230424
[考研] 298调剂 +3 jiyingjie123 2026-03-27 3/150 2026-03-27 11:57 by wxiongid
[考研] 调剂求收留 +7 果然有我 2026-03-26 7/350 2026-03-27 00:26 by wxiongid
[考研] 调剂 +4 柚柚yoyo 2026-03-26 4/200 2026-03-26 20:43 by fmesaito
[考研] 化学调剂一志愿上海交通大学336分-本科上海211 +4 小鱼爱有机 2026-03-25 4/200 2026-03-26 10:19 by aa331100
信息提示
请填处理意见