MATLAB Answers

How can I animate this plot3?

31 views (last 30 days)
María Paulina Pantoja Gavidia
Answered: Walter Roberson on 3 Mar 2021
I did this plot using the mapping toolbox but I cannot animated it, can somebody help me?
Lat = [28.7227824 28.7227834 28.7227844 28.7227855 28.7227866 28.7227877 28.7227880 28.7227890 28.7227904 28.7227937 28.7227937 28.7227938 28.7227949 28.7227948 28.7227947 28.7227957 28.7227968 28.7227969 28.7227978 28.7227967 28.7227987 28.7227998 28.7227989 28.7227978]
Lon = [-111.6665086 -111.6665065 -111.6665060 -111.6665058 -111.6665052 -111.6665049 -111.6665038 -111.6665046 -111.6665047 -111.6665054 -111.6665054 -111.6665060 -111.6665062 -111.6665072 -111.6665081 -111.6665086 -111.6665085 -111.6665090 -111.6665098 -111.6665102 -111.6665099 -111.6665108 -111.6665096 -111.6665097]
Alt=[3.112 6.120 9.621 10.223 11.627 15.267 17.627 19.267 19.548 20.113 22.366 25.566 25.215 27.548 27.697 26.112 23.113 22.366 18.566 15.215 13.654 10.665 7.667 4.322 ]
figpos = [1000 500 800 400];
uif = uifigure("Position",figpos);
ug = uigridlayout(uif,[1,2]);
p2 = uipanel(ug);
gg = geoglobe(p2);
geoplot3(gg,Lat,Lon,Alt,"c","LineWidth",2,"HeightReference","geoid")
hold(gx,"on")

Answers (1)

Walter Roberson
Walter Roberson on 3 Mar 2021
geoplot3() returns a line object. You can pull the XData, YData, ZData coordinates out of the line object and delete the line object, and then construct animatedline() and loop through adding points to the line to animate it.

Community Treasure Hunt

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

Start Hunting!