I want to draw the previous point Delete the next point
6 views (last 30 days)
Show older comments
Amir Azadeh Ranjbar on 19 Aug 2022
Commented: Amir Azadeh Ranjbar on 22 Aug 2022
%__________________________ This is to return to the previous point
[num2str(app.i),"Volocity : ",num2str(app.Cent_Viloc(app.i).Velocity(1))],"FontSize",10,"FontWeight",...
'BackgroundColor',[1 1 1])
%__________________________ This is to go to the next point
[num2str(app.i),"Volocity : ",num2str(app.Cent_Viloc(app.i).Velocity(1))],"FontSize",10,...
'BackgroundColor',[0.6 0.2 0.5])
Edited: dpb on 20 Aug 2022
Unfortunately, TMW has removed a lot of the previous documentation illustrating these things -- they think animatedline is supposed to be all anybody should ever need -- the only existing example I find in current doc is <trace-marker-along-line>, but it does illustrate the technique of updating the plot handle data directly.
The Q? in your case is what is supposed to happen between points when delete one -- although I guess it's a case of only going back a single step at a time?
Edited: dpb on 21 Aug 2022
I had not poked at an animatedline object with Yair Altman's FEX submission to find hidden properties, but it turns out the X|YData arrays are pre-allocated (looks like begins with 5,000 by default) and buried several layers deep, but accessible if you know the magic decoder ring password...
Try this to get the idea and then you can adapt to your app variables, needs...
hAL=animatedline('Marker','o'); % create object, keep handle
xlim([0 1]);ylim([0 1]) % keep limits fixed so doesn't autorange on us
for i=1:5 % add some points...
for i=hAL.NumPointsAdded:-1:1 % now we'll remove them in reverse order
hAL.NodeChildren.Children.XData(hAL.NumPointsAdded)=nan; % convert so won't display
hAL.NumPointsAdded=hAL.NumPointsAdded-1; % update the point count to match
Supercially, this seems to work; what other issues may arise by munging on the object through undocumented, hidden properties only experimentation will uncover.
NOTA BENE: The X|YData arrays are initialized to zero in the object properties but no zero point is displayed initially until a specific entry at the origin were to be made via addpoints. But, in the above setting the value back to zero even though the number of points is also decremented results in the zero showing as a point at the origin; hence the use of NaN to take advantage of the builtin feature of HG that only finite values are rendered. Somewhere internally is other logic that "knows" the difference between zeros that were initial values and uses some other indicator besides only 'NumPointsAdded' to render only the first N points, but I didn't find what the key indicator is in this short investigation into the internals.
If it works to serve your purposes, well and good; but if it crashes and burns, you're on your own to figure out why and if can work around it. And, of course, just because it might work now doesn't mean the next release won't change something that breaks it.
More Answers (0)
Find more on Develop Apps Using App Designer 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!