MATLAB: How to display only current figure

display current figurefigureMATLABmatlab m-fileplot

Hello,
I am currently doing some work in Matlab script (m file). It will generate a lot of figure when I run the file, but I only want it to display only the last figure.

Best Answer

Then close them
h = figure;
% now close it
close h;
% Open a new one
h = figure;
% and so on.
Or just do
close all;
right before you show your last figure.