Domanda

Is it possible to do this? In particular I want to toggle between warning ("off", "Octave:broadcast") and warning ("on", "Octave:broadcast"), i.e. set warning off at the beginning of the .oct file and then set warning on just before the .oct file returns its output. Of course I could do this in the terminal or in the calling script file, but I'd like to do it in the .oct file itself if possible.

È stato utile?

Soluzione

There's two ways to do it in C++, very similar to the Octave language itself.

disable_warning (const std::string& id);
set_warning_state (const std::string &id, const std::string &state);

Actually, disable_warning is just wrapper around the second option set_warning_state (id, "off"). Take a look into the error.cc for more options related to this. I'm sure you can figure out yourself how to turn the warning back on at the end ;)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top