フィルターのクリア

How can I save a figure to a variable includes address?

1 回表示 (過去 30 日間)
Hamed
Hamed 2015 年 10 月 21 日
編集済み: Hamed 2015 年 10 月 21 日
this is what I am doing:
name=strcat(part1,'-',part2,'.jpg')
name =
'10-1.jpg'
name2=fullfile(folder,name)
name2 =
[1x87 char]
saveas(figure1,name2)
Error using saveas (line 59)
Invalid handle.
thanks for your helps.

採用された回答

Walter Roberson
Walter Roberson 2015 年 10 月 21 日
Either part1 or part2 is a cell array of strings and needs to be a string instead. You could look back further in your code and make it a string instead of a cell array of strings, or you could use
name = strcat( char(part1), '-', char(part2), '.jpg');
I would normally code the char(part1) as part1{1} but I do not know which of the two is the cell and using char() covers all the cases.
  1 件のコメント
Hamed
Hamed 2015 年 10 月 21 日
編集済み: Hamed 2015 年 10 月 21 日
thanks for your answer. part1 and part2 were cell arrays. I changed defining name as you said, and it is working

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePrinting and Saving についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by