Publishing from livescript doesn't show graphs

7 views (last 30 days)
Hello! I am trying to publish a simple script (.m extension, let it be MyScript.m) with some graphs. When I have this script opened in matlab and I try to publish it via default matlab publish tool (special section "publish" at the top of the matlab window), it works well. I mean, during the publishing, matlab generates and opens a new window for each figure, and the document (I publish it to html) contains all the graphs.
But I need to generate some dozens of these reports, and I would like to do it in a loop via livescript, using publish(MyScript.m) function. But it doesn't work. When I run publish(MyScript.m), I have only a html file without the graphs.
How does it work? What is the problem?
I tried it with different settings, but it still doesn't work. As an example, here is a code.
%% Test Code
% descrtiption
%% Intro
% bla bla bla
x=linspace(-2, 2, 1000);
figure();
plot(x,sin(x));
figure();
plot(x,cos(x));
figure();
plot(x,x.^2);
I tried snapnow after each plot, but the result is the same.
I cannot understand, what is the problem. Can you help me, please?

Answers (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 20 May 2021
1st, execute your code
2nd publish. It will work as it should.
Good luck.

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!