MATLAB: How to use a figure as ‘if condition’?!

figure

I's using an m file to plot some data, online. I want to make an 'if condition', when I close the figure that is plotting my data manually!! Shortly, How could I Initialize a loop by closing a specific figure?!(as I close the figure the loop being started)

Best Answer

Would this work?
f1=figure;
...
status=close(f1);
You can then check the "status" using "if"