MATLAB 2016a introduced Live Scripts, allowing to show plotting output next to the script. Is it somehow possible to show animations? For example, the following code in a regular script will plot a few points and then rotate the axes
:
x = rand(10, 3);
plot3(x(:, 1), x(:, 2), x(:, 3), 'o')
for ii = 1:360
camorbit(1, 10*cos(ii/90*pi)*pi/45)
drawnow
pause(0.01)
end
If this is embedded in a Live Script, the initial plot is shown, then seemingly nothing happens while the loop is running, then the last aspect (which is the same as the original plot) is shown in a new display item.
Alternatively, is there an option to interact with the plots in a live script (other than double-clicking to open the plot in a new figure)? E.g. rotate3d
does not have an effect.
Edit: As of release 2019a, animations are possible as per release notes.
snapnow
instead ofdrawnow
if you wanted a snapshot in the publisher. If Live Scripts have borrowed code from publisher then this might be worth a try. 2) If instead of a for-loop you create an actual movie object and play it back with themovie
command, the LiveScript might be set up to interpret it correctly. 3) If the LiveScript is proper html-based then it may support animated gifs; create one usingimwrite
and individual frames. (Let me know if any of the above work. :) ) – Chimeramovie
only shows last frame, 3) Haven't tried animated gifs. That's last resort :) – Fauver