user1068636
user1068636

Reputation: 1939

how do you show all plots in an m-file when publishing in MATLAB R2016a?

In MATLAB R2016a if you want to publish the output of an m-file you have to click on "Publish" tab at the top, and then click on the "Publish" button. I tried to publish my m-file (shown below),however, only 1 of 4 plots shows up in the pulished HTML file. How do you get all 4 plots to show up in the "published" output of the script below?

ezplot((x-1)^3*(x+2)); 
ezplot3(sin(t),cos(t),t);
P=[1,2,-3];Q = [1,0,2]; PQ = Q-P; l = t*PQ+P; ezplot3(l(1),l(2),l(3),0,1)
[x y] = meshgrid(-5:0.05:5);z = (2-x+2*y)/3; mesh(x,y,z); xlabel('x'); ylabel('y');zlabel('z');title('x - 2y + 3z = 2');

Upvotes: 1

Views: 225

Answers (1)

dubafek
dubafek

Reputation: 1113

You should use figure before each plot. I tried your code in MATLAB R2014b doing that and it worked. Here is the code I used, I made a few typing corrections because the code wasn't running for me. But the figure part is the important one in here.

figure(1)
ezplot('(x-1)^3*(x+2)')
figure(2)
ezplot3('sin(t)','cos(t)','t')
P = [1,2,-3];
Q = [1,0,2];
PQ = Q-P;
l1 = strcat('t','*',int2str(PQ(1)),'+',int2str(P(1)));
l2 = strcat('t','*',int2str(PQ(2)),'+',int2str(P(2)));
l3 = strcat('t','*',int2str(PQ(3)),'+',int2str(P(3)));
figure(3)
ezplot3(l1,l2,l3,0,1)

[x, y] = meshgrid(-5:0.05:5);
z = (2-x+2*y)/3;
figure(4)
mesh(x,y,z)
xlabel('x');
ylabel('y');
zlabel('z');
title('x - 2y + 3z = 2');

MATLAB creates different windows for different figures but you have to say that you want a different figure's window to make MATLAB creates it. For more information you can go here.

Upvotes: 2

Related Questions