How can I use the image data stored in setappdata twice in my code?

I stored an image data using setappdata in this function. I would like to use this image data twice in 2 separate functions. How can this be done?

 Accepted Answer

Either use nested functions and shared variables, or getappdata() in both functions where you need the data.

3 Comments

I used getappdata(), but GUI did not display the image data I needed. It worked for the first function, but for another function when I tried to retrieve the same image data, it did not show at all.
getappdata() does not display data; you need to imshow() or image() or imagesc() the retrieved data.
And of course the retrieval has to be after the data has been stored; in your second case your flow of routines might not have stored it yet.
yes! I got it, thank you so much for all your help!:)

Sign in to comment.

More Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!