how to close a particular figure file if it exists
Show older comments
how to close a particular figure file
i used the below figure file.....
figure(6),
set(gcf, 'Name','Selected Image','numbertitle','off');
imshow(inputImage);
now the second time i execute if that figure file exists i want to delete only that particular figure file... i did as below...
if exist('Selected Image', 'file')
close 'Selected Image'
end
no error is showing nor it is getting deleted..... how to write the syntax... please do reply.....
Accepted Answer
More Answers (1)
Mahdi
on 9 Apr 2013
I tried running the same thing and it worked, however, I assume that your main problem is in the if statement, not the close line.
Run the script in debugger and see if it's actually going through the if statement. Look up how the exist() outputs work because 1 is not always the output. I would suggest changing it to something like
if exist('Selected Image', 'file')~=0
close 'Selected Image'
end
Categories
Find more on Basic Display in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!