フィルターのクリア

image array save it

2 ビュー (過去 30 日間)
Patrick Brown
Patrick Brown 2017 年 3 月 13 日
回答済み: Walter Roberson 2017 年 3 月 13 日
I have an image array fig and I want to save it but I get this error
fig =
1x2 Image array:
Image Image
>> saveas(fig,'a','pdf')
Error using saveas (line 58)
Invalid handle.
thanks!

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 3 月 13 日
You have two difficulties:
1) One of your images is already deleted. That can happen if you create images in a loop (or implicit loop) without "hold on" being on. For example,
for K = 1 : 3; fig(K) = imagesc(rand(40,80,3)); end
The imagesc() for K == 1 draws an image, but then when it is time to imagesc() for K == 2, because hold is not on, it does a cla, which deletes the image object created for K == 1.
This is your most immediate problem: you are working with the handle to something already deleted.
2) When you get that solved, you have the problem that saveas() only accepts scalars for its first argument. You cannot saveas() a pair of images. If the two have a common parent axes you can saveas() that common parent axes.

カテゴリ

Help Center および File ExchangeDisplay Image についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by