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.
MATLAB® live scripts and live functions are interactive documents that combine MATLAB code with formatted text, equations, and images in a single environment called the Live Editor. In addition, live scripts store and display output alongside the code that creates it.
MATLAB converts publishing markup from the original script to formatted content in the new live script. To open an existing script ( . m ) as a live script ( . mlx ) from the Editor, right-click the document tab, and select Open scriptName as Live Script from the context menu.
1. How is a Live Script different from a regular script? Ans:A Live Script combines regular text and MATLAB code. It allows the user to create a nicely formatted document with embedded code and the output of the code such as plots.
It seems the answer is no - Live Scripts are too young to be that feature rich yet. The fact alone that they're undebuggable would make me stay away from them for 1-2 versions more. Have you looked into Matlab Notebooks? If you're after pretty formatting and some basic interactivity, It might be what you seek.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With