I manipulate data on a plot using its handle
x = 1:10; y = sin(x);
h1 = line(x,y);
However, if the figure gets closed before the script actually terminates, doing something like this returns an error.
>>set(h1,'Color','green') % line is green
??? Error using ==> set
Invalid handle object.
Is there a way to check if h1
is a valid handle before doing any manipulations with it?