MATLAB Answers

0

Does the Live Editor support figure animations?

I would like to know if the Live Editor supports figure animations.

2 Answers

Answer by MathWorks Support Team on 21 Aug 2019
Edited by MathWorks Support Team on 21 Aug 2019
 Accepted Answer

From R2019a, Live Editor supports the animation feature.
To enable this feature, please run the following command.
settingsObj = settings;
settingsObj.matlab.editor.AllowFigureAnimation.TemporaryValue = 1;
In R2018b and previous version, please refer the followings.
it is not supported. You can, however, double-click the figures within the Live Editor to get a full figure window with full graphics capabilities.

  0 Comments

Sign in to comment.


Answer by Arjun Nair on 14 May 2019

As of 19a release, Live Editor does support figure animations. But it has to be enabled via a setting.
Please use the following setting to get figure animations in live editor:
s = settings;
s.matlab.editor.AllowFigureAnimation.TemporaryValue = 1
You can also refer the doc page and search for AllowFigureAnimation:

  1 Comment

Hi, it seems this setting changes something.
The example in the release notes runs well, but with the settings if I run the code :
s = settings;
s.matlab.editor.AllowFigureAnimation.TemporaryValue = 1
a = [-0.5572,-0.7814;0.7814,0];
b = [1,-1;0,2];
c = [1.9691,6.4493];
sys = ss(a,b,c,0);
step(sys)
It successfully shows the plot, but throws some errors:
Error using DynamicSystem/step (line 95) Array indices must be positive integers or logical values.
If I run :
s = settings;
s.matlab.editor.AllowFigureAnimation.TemporaryValue = 1
figure
Z = peaks;
surf(Z)
axis tight manual
ax = gca;
ax.NextPlot = 'replaceChildren';
loops = 40;
F(loops) = struct('cdata',[],'colormap',[]);
for j = 1:loops
X = sin(j*pi/10)*Z;
surf(X,Z)
drawnow
F(j) = getframe;
end
it show the errors:
Dot indexing is not supported for variables of this type.
Error in matlab.graphics.internal.mlprintjob/setPaintDisabled
Error in alternatePrintPath
Error in alternatePrintPath
Error in alternatePrintPath
Error in alternateGetframe
Error in alternateGetframe
Error in getframe (line 136)
x = alternateGetframe(parentFig, offsetRect, scaledOffsetRect, includeDecorations);
Anything wrong?

Sign in to comment.