I want to draw the previous point Delete the next point
Show older comments
%__________________________ This is to return to the previous point
app.i=app.i-1;
if app.i>1
addpoints(app.hnext,app.Cent_Viloc(app.i).Center(1),app.Cent_Viloc(app.i).Center(2))
text(app.UIAxes,app.Cent_Viloc(app.i).Center(1)+0.2,app.Cent_Viloc(app.i).Center(2)+0.2,...
[num2str(app.i),"Volocity : ",num2str(app.Cent_Viloc(app.i).Velocity(1))],"FontSize",10,"FontWeight",...
"bold","Color",'y',...
'BackgroundColor',[1 1 1])
drawnow
end
%__________________________ This is to go to the next point
app.i=app.i+1;
if app.i>1
addpoints(app.hnext,app.Cent_Viloc(app.i).Center(1),app.Cent_Viloc(app.i).Center(2))
text(app.UIAxes,app.Cent_Viloc(app.i).Center(1)+0.2,app.Cent_Viloc(app.i).Center(2)+0.2,...
[num2str(app.i),"Volocity : ",num2str(app.Cent_Viloc(app.i).Velocity(1))],"FontSize",10,...
"FontWeight","bold","Color",'white',...
'BackgroundColor',[0.6 0.2 0.5])
drawnow
end
5 Comments
dpb
on 19 Aug 2022
No idea what the Q? really is, sorry.
Please explain in detail what you're trying to do and where you have a specific problem.
A minimum working example that folks can run that illustrates the issue would be best and more likely to draw attempts than dense code without any inputs to try to use it.
Amir Azadeh Ranjbar
on 20 Aug 2022
dpb
on 20 Aug 2022
AFAIK, TMW did not see fit to provide a method by which to delete an arbitrary point from an animatedline object; that seems an obvious oversight; clearpoints unfortunately doesn't have the option to select a given point from the existing points, but clears the whole line. Doing that and then refreshing with the ones left wanted would undoubtedly cause undesirable repainting the display.
I've not tried it, but the only two choices I see would be
- Don't actually remove the point but redraw it in background color so it is not visible -- this may not produce the desired effect because it is still in the line object, so there probably is only one choice left I see...
- use the refreshdata method with a data source that you update to remove the point from the X, Y arrays before calling -- I've never tried this with and animated line, so not sure if it works or not; you'll have to 'spearmint and see.
The only other alternative I see OTOMH would be to not use animatedline but revert to plot on a point-by-point basis with the old-school animation technique of simply updating the X|YData arrays directly. Unfortunately, those are not visible with the animated line object.
Amir Azadeh Ranjbar
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?
Accepted Answer
More Answers (0)
Categories
Find more on 2-D and 3-D Plots 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!