Disable plots in Matlab

前端 未结 3 1108
不知归路
不知归路 2021-01-02 04:12

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

3条回答
  •  迷失自我
    2021-01-02 05:11

    The previous methods are fine, but an easy and good habit to take is to use a "on/off parameter". So basically, at the beginning of your code, you can add something like:

    DisplayFigure = 1; %1 = display, 0 = no display
    

    After that, add "if DisplayFigure == 1 ... end" for all your plotting related commands, where the commands should be inside the if statement (the ... above). Hence you won't even compute the plots, which will save you a lot of time and memory. You just have to change the value of the variable "DisplayFigure" to plot or not the figures.

提交回复
热议问题