MATLAB Answers


Can I know if a script is currently being run normally (F5) or being published?

Asked by Ben
on 12 Oct 2015
I use Matlab to tune algorithms. When done, I typically publish the results to doc or PDF. Before publishing, I typically add specific explanatory text output and graphical formatting instructions that are normally not needed.
When I run the script normally I don't need those because they slow the program down. But when I publish results occasionally, I need them. For the moment, I declare a PUBLISH variable to 0 or 1 at the beginning of the script and do the formatting stuff only if the value is 1. It works but it's a bit cumbersome becaise I need to remember to change the value.
I'd like to know if there is a way, from within a script, to know whether said script is being run normally (e.g. launched from F5) or whether it is being published? Something like an isBeingPublished boolean, for example?
Thanks in advance for your help!


Sign in to comment.

0 Answers