Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
close('name') or close(handle)

Subject: close('name') or close(handle)

From: Maxx Chatsko

Date: 23 Jul, 2010 12:36:05

Message: 1 of 7

Hello all,
    I have a gui that plots up to 3 spectral plots in seperate figures based upon user selection when a pushbutton is pushed. I want to close any open plot figures when the user pushes the pushbutton on the main gui figure. The plot figures are named using sprintf and I can't figure out how to close them. I create the figures using the figure command.
      -Do I use close('name') or close(handle) and how?
                 Thanks
                  Maxx
Need more details? Ask away

Subject: close('name') or close(handle)

From: Robert

Date: 23 Jul, 2010 12:45:42

Message: 2 of 7

"Maxx Chatsko" <chatskom@chemimage.com> wrote in message <i2c2bl$5v$1@fred.mathworks.com>...
> Hello all,
> I have a gui that plots up to 3 spectral plots in seperate figures based upon user selection when a pushbutton is pushed. I want to close any open plot figures when the user pushes the pushbutton on the main gui figure. The plot figures are named using sprintf and I can't figure out how to close them. I create the figures using the figure command.
> -Do I use close('name') or close(handle) and how?
> Thanks
> Maxx
> Need more details? Ask away

"close all" will close all open figures,
also if your stored the handles to the figures you can "close ( handle)"

Subject: close('name') or close(handle)

From: Maxx Chatsko

Date: 23 Jul, 2010 13:04:09

Message: 3 of 7

"Robert " <rcumming@matpi.com>
> "close all" will close all open figures,
> also if your stored the handles to the figures you can "close ( handle)"

      I need the main gui figure to still be open so I cannot do that.

Subject: close('name') or close(handle)

From: Robert Cumming

Date: 23 Jul, 2010 13:13:08

Message: 4 of 7

"Maxx Chatsko" <chatskom@chemimage.com> wrote in message <i2c409$en3$1@fred.mathworks.com>...
> "Robert " <rcumming@matpi.com>
> > "close all" will close all open figures,
> > also if your stored the handles to the figures you can "close ( handle)"
>
> I need the main gui figure to still be open so I cannot do that.

Ok that wasn't clear in your opening mail.

Close then by individual handles then.

Subject: close('name') or close(handle)

From: Maxx Chatsko

Date: 23 Jul, 2010 13:22:08

Message: 5 of 7

"Robert Cumming" <rcumming@matpi.com>

>Ok that wasn't clear in your opening mail.

 "I want to close any open plot figures when the user pushes the pushbutton on the main gui figure."

     Thanks for the handles reference. I didn't specify the right handles when I tried the code originally, but went back on your help. Sorry for the confusion.
                          Maxx

Subject: close('name') or close(handle)

From: Walter Roberson

Date: 23 Jul, 2010 13:32:09

Message: 6 of 7

Maxx Chatsko wrote:

> I have a gui that plots up to 3 spectral plots in seperate figures
> based upon user selection when a pushbutton is pushed. I want to close
> any open plot figures when the user pushes the pushbutton on the main
> gui figure. The plot figures are named using sprintf and I can't figure
> out how to close them. I create the figures using the figure command.
> -Do I use close('name') or close(handle) and how?

Set the close request function for your main gui to ignore the close
attempt, and then use close('all') to close the other figures.

Subject: close('name') or close(handle)

From: Maxx Chatsko

Date: 23 Jul, 2010 13:50:21

Message: 7 of 7

Walter Roberson <roberson@hushmail.com>
> Set the close request function for your main gui to ignore the close
> attempt, and then use close('all') to close the other figures.

  ......'handleVisibility','off') ?

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us