How could I update the imshow?
10 views (last 30 days)
Show older comments
Shaofan Guo
on 26 Feb 2017
Commented: Shaofan Guo
on 27 Feb 2017
Hi,all,
I have a GUI which receive the data through the serial port continuously. And I want to use these data to show the location trace in the picture using imshow.
Afterwards I realize the memory is reduced bacause I continuing creat a new image in the same axes.
So I would like to know how can I updating the imshow rather than creating a new image.
ditu =imread('google.bmp');
[M,N]=size(ditu(:,:,1))
ditu((M-y-1):(M-y+1),((x-1):(x+1)),1)=255;
ditu((M-y-1):(M-y+1),((x-1):(x+1)),2)=0;
ditu((M-y-1):(M-y+1),((x-1):(x+1)),3)=0;
imshow(ditu, 'Parent', handles.axes1);
Thank you,
Shaofan
0 Comments
Accepted Answer
Image Analyst
on 26 Feb 2017
Calling imshow() multiple times will put multiple images into your axes. To avoid that and keep just one image at a time in there, use cla or cla reset
axes(handles.axes1);
cla reset;
imshow(ditu, 'Parent', handles.axes1);
More Answers (0)
See Also
Categories
Find more on Creating, Deleting, and Querying Graphics Objects 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!