Selective retaining of graphic object in App Designer

1 view (last 30 days)
Hi! I am developing a code (rather re-writing an old code) in App Designer where I have displayed two grapahic objects: an image using pcolor and a contour (made of connected lines) using plot. Now, I want to set up a callback function using WindowButtonDownFcn and WindowButtonMotionFcn, where I can tweak the contour by adding more points, while keeping the displayed image intact.
I am experiencing a problem that I cannot animate the movement of the contour using WindowButtonMotionFcn if I use hold on. It does not clear the earlier plots, even when drawnow is used. I can animate the contour if I do not use hold on, but in that case the image is also gone and I have to redraw the image everytime during animation (which makes the process slow).
In earlier graphic system (prior to MATLAB 2014b), I have achieved the same by using hold on and drawnow when plotting. But, now it seems the selective updating of the graphic object is not working.
Any help will be appreciated. Thanks!
  3 Comments
Sreerup Banerjee
Sreerup Banerjee on 13 Aug 2020
Hi! Alex, Let me explain why I have used the word 'animate'. Suppose, there is an image diplayed and there is a specific region of interest (ROI) I want to identify by drawing a contour. Then I can design an algorithm that will capture the ROI using certain image feature and generate a contour adhering the ROI edge. Now, if I am not satisfied by the genrated contour (say, in the case it did not fit the ROI properly), then I have to modify it.
One way to edit the contour is to add a point to the contour which is placed at appropriate place. In this regard, I want to use the WindowButtonDownFcn and WindowButtonMotionFcn so that I pick a point on the contour and place it where I want. Bewteen the clicks to select the point on the contour and placing it to where I want, the contour can be animated as I hover the mouse on the figure window (WindowButtonMotionFcn). Throughout the process the image should remain displayed.
The older code performs the task successfully in the earlier graphic system, but there may be certain modification due to changes in the graphic system since 2014b version, and now I cannot acheive the same result. Possibly it is associated with the change in behaviour of hold on, which is behaving like hold all. I am in the search of a work around.
J. Alex Lee
J. Alex Lee on 14 Aug 2020
ok that's clearer. maybe i should have just suggested for you to post a minimal example of your old code.

Sign in to comment.

Answers (0)

Categories

Find more on Graphics Performance in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!