Question: suppress warnings using writeto

I've got the problem of warnings polluting my text outputs.

If I use interface(warnlevel = 0) the warnings are suppressed in the terminal but not in the files exported by the writeto command.

A sample:

> restart;with(CodeGeneration); with(plots); with(ListTools); with(FileTools);
> Matlab(u(1) = 3);
Warning, the function names {u} are not recognized in the target language
cg = u(1) == 3;
> interface(warnlevel = 0); Matlab(u(1) = 3);
cg0 = u(1) == 3;
> writeto("testfile2.txt")*interface(warnlevel = 0); Matlab(u(1) = 3); writeto(terminal);

The sample produces a testfile that consists of the warning and the result.

Is there a possibility to ommit these warnings in the outputfile?

Or is there a work around to get rid of these lines?

Please Wait...