the error message is telling you that f1 is not a valid handle to a figure. Could you do
ishandle(f1)
and tell us what the output is. Maybe you have already closed the figure to which the handle is referring?
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!