Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
286 views
in Technique[技术] by (71.8m points)

imagesc plot to matrix in matlab

I would like to save in a matrix the plot that imagesc returns. How can I do that? All I know that imagesc returns a handle and I don't know what to do with it.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The data for imagesc is stored in the CData property, so use this to extract it:

X = get(h, 'CData');

assuming h is your handle.

Now X contains your image data, and you can save it to a file, for instance:

save somefile.mat X

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...