Update Imagesc on Button Press
9 views (last 30 days)
Show older comments
Hi,
I have a large matrix of values (1024x3533) that I am using to draw an image using imagesc. I am doing this with four subplots. On my computer, this takes approximately 60 seconds.
On two of the images, I am assigning certain rows to act as boundaries. For example, I might make
(300, :) = -30
(600, :) = -30
so that a yellow line appears at these rows.
I would like to have a button on my GUI that increases the indices of these lines when pressed. My y-axis is reversed, so when I press the button, the indices would "increase" to
(299, :) = -30
(599, :) = -30
This sounds simple enough in theory. However the way I am attempting it requires the entire image to be redrawn. So far I have not gotten this to work, and it is very hard to troubleshoot due to the size of the images being drawn, and the time it takes to draw them.
Is there a way I can simply redraw a portion of an image using imagesc? So for example, I would only redraw the boundary lines described above? Alternatively, is there a way to superimpose an image containing only the lines on top of the existing image?
0 Comments
Accepted Answer
Sean de Wolski
on 17 Dec 2012
Just update the 'CData' of the image. I.e:
myCData = get(hImage,'CData');
myCData(10,:) = pi;
set(hImage,'CData',myCData);
This will alleviate having to call the destructor for the existing image and the constructor for the new one which will save a bunch of time since the settings are all the same.
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!