From: Sang-Ho Yun on 30 Apr 2010 04:17 I am trying to make a simple function that closes all figures except one. To do that, I need to know all open figure handles. For example, if figure(1), figure(3) and figure(7) are open, I need to run close(1), close(3), and close(7). But how do I get the information of 1, 3, and 7? Is there a way to get all the open figure handles? Thank you, Sang-Ho
From: us on 30 Apr 2010 05:41 Sang-Ho Yun <Sang-Ho.Yun(a)jpl.nasa.gov> wrote in message <C7FFE00C.63C0%Sang-Ho.Yun(a)jpl.nasa.gov>... > I am trying to make a simple function that closes all figures except one. > To do that, I need to know all open figure handles. > > For example, if figure(1), figure(3) and figure(7) are open, > I need to run close(1), close(3), and close(7). But how do I > get the information of 1, 3, and 7? Is there a way to get all > the open figure handles? > > Thank you, > Sang-Ho one of the solutions nf=5; for i=1:nf figure; end fh=findall(0,'type','figure').' % fh = 5 4 3 2 1 % <- note the order! % now, close some... close(fh([2,4,5])); % and check again... fh=findall(0,'type','figure').' % fh = 5 3 us
From: Steven Lord on 30 Apr 2010 09:53 "us " <us(a)neurol.unizh.ch> wrote in message news:hre8jf$11p$1(a)fred.mathworks.com... > Sang-Ho Yun <Sang-Ho.Yun(a)jpl.nasa.gov> wrote in message > <C7FFE00C.63C0%Sang-Ho.Yun(a)jpl.nasa.gov>... >> I am trying to make a simple function that closes all figures except one. >> To do that, I need to know all open figure handles. >> >> For example, if figure(1), figure(3) and figure(7) are open, >> I need to run close(1), close(3), and close(7). But how do I >> get the information of 1, 3, and 7? Is there a way to get all >> the open figure handles? >> >> Thank you, >> Sang-Ho > > one of the solutions > > nf=5; > for i=1:nf > figure; > end > fh=findall(0,'type','figure').' > % fh = 5 4 3 2 1 % <- note the order! > % now, close some... > close(fh([2,4,5])); If you know the figures that you want to close are in those positions in the list of figures returned by that FINDALL call, then you can do this. If instead you just have the handle of the figure you want to remain open, you could SETDIFF this list with the known handle and pass the resulting vector into CLOSE. That would make your code agnostic to the order of the handles returned by FINDALL. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
|
Pages: 1 Prev: Simulation problem in Simulink Next: bode/nyquist plot from a matrix with complex numbers |