0

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.

babelproofreader
  • 530
  • 1
  • 6
  • 20
  • the Octave broadcasting issue is only applied when it performs automatic broadcasting. Does it also works when you're in a oct file? – carandraug Oct 10 '13 at 15:59
  • @carandraug Yes. This is the warning I'm getting when running the .oct from the terminal. I'm doing matrix subtraction and element division as in result = quotient( ( A - B ) , C ); where A is a one-dimensional matrix and B and C are single element matrices. – babelproofreader Oct 10 '13 at 19:35

1 Answers1

1

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 ;)

carandraug
  • 12,938
  • 1
  • 26
  • 38