image array save it

3 Ansichten (letzte 30 Tage)
Patrick Brown
Patrick Brown am 13 Mär. 2017
Beantwortet: Walter Roberson am 13 Mär. 2017
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!

Antworten (1)

Walter Roberson
Walter Roberson am 13 Mär. 2017
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.

Kategorien

Mehr zu Performance and Memory finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by