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 7781941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:23:03+00:00 2026-06-01T19:23:03+00:00

I have some programs written in Matlab that I need to run several times

  • 0

I have some programs written in Matlab that I need to run several times for some reasons (debugging, testing with different input, etc…)

But, there are a lot’s of graphs that are plotted by the programs and its various functions such that everytime I run the program, I have to wait for all the graphs to be displayed, which is very annoying and time consuming (especially when you are working with a small laptop).
After the program is executed, I close them with a close all.

So my question is:

Is there a way to disable all plots/figures/graphs in Matlab? either in the options, or by executing a certain code like disable plot and enable plot to ensure that no figures are being displayed.

I know that I can just browse the code and comment the plotting part, but I don’t want to forget to uncomment.

  • 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-06-01T19:23:04+00:00Added an answer on June 1, 2026 at 7:23 pm

    Try some combination of the two commands:

    set(gcf,'Visible','off')              % turns current figure "off"
    set(0,'DefaultFigureVisible','off');  % all subsequent figures "off"
    

    The second one, if you put it near the beginning of your program, might do the trick for you. Of course, it is still creating the plots, which might be undesirable for computation time and/or RAM issues.

    This is a classic reason to avoid Matlab when one can. It fosters bad programming design. To solve this problem correctly, you should create something that lets you “flip a switch” at the highest level of your program and control whether plots show or do not show. Perhaps it even has gradations of the show/don’t show option so you can select different types of plots that do/do not show depending on what diagnostics you are running.

    Ideally, you’d want this “flip a switch” creation to be a class that has access to visibility and plot functions of other objects. But because interactive object-orientation is so cumbersome in Matlab, it’s often not worth the effort to develop such a solution, and most people don’t think about this design aspect from the outset of their project.

    Matlab would encourage someone to solve this by making flag variables like “isPlotVisible” or something, and creating functions that always accept such flags. I agree this is a bad design.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have seen that some programs which were written by me and assembled for
We have several apps that run on a Windows 2003/2008 server. Some of these
I have some custom programs I've written to do various maintenance/monitoring tasks that I
I'm starting to learn about COBOL. I have some experience writing programs that deal
I am debugging some programs. In per-instruction debugging (Eclipse CDT), I have come across
I have written some basic c++ programs in one of my classes for school.
I have some stuff written in c# that executes concurrent code, making heavy use
I've written some small programs that help me out parsing/analysing data. I want to
We have some COBOL programs in our financial applications which need to interact with
I have written some smaller rails programs before and am fairly well versed in

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.