x=rand(1,10);
y=1:10;
h=plot(x,y,'r',x,y,'g');
saveas(h, 'test','jpg');
I want to save the plot above but i get an error
??? Operands to the || and && operators must be
convertible to logical scalar values.
Error in ==> saveas at 64
while ~isempty(h) && ~isfigure(h)
I know its because h has two values, I just dont know how to save both of these in the same image file.

 採用された回答

Albert Yam
Albert Yam 2012 年 7 月 13 日

0 投票

The 'plot' is the line, what you want to save is the figure.
h=figure;
x=rand(1,10);
y=1:10;
plot(x,y,'r',x,y,'g');
saveas(h, 'test','jpg');

1 件のコメント

Nirmal
Nirmal 2012 年 7 月 13 日
Thank you. That was quick Sir.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Printing and Saving についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by