MATLAB suppress MEX compilation output except for “success” statement?

5 visualizaciones (últimos 30 días)
Danylo Malyuta
Danylo Malyuta el 27 de Jun. de 2016
Respondida: Samarth Shah el 11 de Jul. de 2016
I am using the Legacy Code Tool to convert C code into a MEX file using the command legacy_code('generate_for_sim',def) (description here). However, the C compiler gives a lot of warnings which do not actually prevent the compiled program from running correctly. I want to suppress these warnings. In particular, the output currently looks something like this (I replaced sensitive information with **):
### Start Compiling *****************************
mex(*****************************)
Building with 'MinGW64 Compiler (C)'.
*****************************:44:6: note: expected 'int *' but argument is of type 'idxint *'
*****************************
^
In file included from *****************************:42:0:
*****************************:44:6: note: expected 'int *' but argument is of type 'idxint *'
*****************************
^
In file included from *****************************:42:0:
*****************************:44:6: note: expected 'int *' but argument is of type 'idxint *'
*****************************
^
MEX completed successfully.
mex(*****************************)
Building with 'MinGW64 Compiler (C)'.
MEX completed successfully.
mex(*****************************)
Building with 'MinGW64 Compiler (C)'.
MEX completed successfully.
mex(*****************************)
Building with 'MinGW64 Compiler (C)'.
MEX completed successfully.
mex(*****************************)
Building with 'MinGW64 Compiler (C)'.
MEX completed successfully.
mex(*****************************)
Building with 'MinGW64 Compiler (C)'.
MEX completed successfully.
mex(*****************************)
Building with 'MinGW64 Compiler (C)'.
C:*****************************: In function 'CheckDataTypes':
C:*****************************:809:5: warning: this decimal constant is unsigned only in ISO C90
*****************************
^
C:*****************************:809:5: warning: this decimal constant is unsigned only in ISO C90
MEX completed successfully.
### Finish Compiling sfun_ecos
### Exit
All done
I want, however, to output only the start and end (to indicate to the user that the compilation was successful) without showing all the intermediate information and warnings. The result should be:
### Start Compiling *****************************
MEX completed successfully.
### Finish Compiling sfun_ecos
### Exit
All done
Thank you in advance for helping me to achieve this.

Respuestas (1)

Samarth Shah
Samarth Shah el 11 de Jul. de 2016
Hi Danylo,
After checking up the syntax/description of the legacy_code() function, I believe that there is no way to suppress the output thrown by the C files.
In general, MEX files can be run in Verbose/Non-Verbose mode. Verbose meaning that it will give out a detailed output while MEXing the files. However, in this case, legacy_code function controls it.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by