Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6914651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:22:29+00:00 2026-05-27T09:22:29+00:00

I have some code which creates a waitbar: if long_process %user specifies this true/false

  • 0

I have some code which creates a waitbar:

if long_process %user specifies this true/false
    h = waitbar(1/4, msg);
end
process(arg1,arg2);

Process is some function which does some plotting. If I do CTRL-C somewhere in process and I get left with a figure window I can just do close all and the figure disappears. However, the waitbar stays. I don’t know how to make that thing close with ‘close all’.

The reason this is bothering is because when I start debugging I often end up having 20+ waitbars open. ‘close all’ then comes in handy.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:22:30+00:00Added an answer on May 27, 2026 at 9:22 am

    Actually, the close function gives you some more “forceful” options:

    close all hidden
    close all force
    

    And if for some reason those don’t work, one “nuclear” option you have is to delete all figures, including those with hidden handles, as suggested in the close and waitbar documentation:

    set(0, 'ShowHiddenHandles', 'on');
    delete(get(0, 'Children'));
    

    You may find it easiest to create your own helper function to do this for you (and return the state of 'ShowHiddenHandles' to its default 'off' state) so you don’t have as much to type:

    function killEmAll
      set(0, 'ShowHiddenHandles', 'on');
      delete(get(0, 'Children'));
      set(0, 'ShowHiddenHandles', 'off');
    end
    

    …And even a third option is to try and avoid the problem altogether (if the organization of your code allows it) by using onCleanup objects! If you run the following sample code, the waitbar should be automatically deleted for you when you CTRL–C out of the infinite loop:

    function runprocess
      h = waitbar(1/4, 'la la la...');
      waitObject = onCleanup(@() delete(h));
      process();
    end
    
    function process
      i = 1;
      while (i > 0)
        i = i + 1;
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created some python code which creates an object in a loop, and
I have some Twisted code which creates multiple chains of Deferreds. Some of these
Context: Windows7, VBScript, ADODB and ADOX. I have written some VBScript code which creates
I have some code in VB6 which creates a moderately-large tree structure (a few
I have a C# code which creates a folder and sets some permissions on
I have some code which creates a synchronised queue which I use in a
I have developed some code which creates excel macros and each time after creation
I am working on some code which is the back-end for a tool. This
I have some code which creates stores on the fly from an ajax request
I have some code which I did not originally create that uses _beginthreadex and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.