plot - Matlab. One script cell returns two figures -


i'm trying make scriptfile various script cells in it, separated %%. following code, returns 1 old figure , 1 circle. want clear figure window 1 figure when execute 1 particular script.

% rita tan(x) x=((-pi/2)+0.01:0.01:(pi/2)-0.01); y=tan(x); plot(x,y) grid on %% % exempel 1 x=linspace(0,8); y=x.*sin(x); plot(x,y) title('f(x)=sin(x)') %% % plot circle t=linspace(0,2*pi); x=cos(t); y=sin(t); subplot(1,2,1) plot(x,y) title('utan axis equal') subplot(1,2,2) plot(x,y) axis equal title('med axis equal') %% % funktionsytor x=linspace(0,5,50); y=linspace(0,5,50); [x,y]= meshgrid(x,y); f=x.*cos(2*x).*sin(y); surf(x,y,f) %% 

what is:

enter image description here

how 1 of them?

use clf (clear figure) delete graphic objects current figure. since seems you'd executing scripts in random order, use clf @ beginning of each section stated reason.
if you're executing script in same sequence shown in question can add clf @ start of section after subplots.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -