Suppress warnings when using mexw32

7 Ansichten (letzte 30 Tage)
Hilward
Hilward am 16 Nov. 2011
I use a read_file.mexw32 to read data from a file into a struct. This struct consists out of several structs in several hierarchies.
When i execute the file I get a lot of same warnings which i want to suppress: Warning: containerSizeStruct not initialized in struct T_ENVIRONMENT Warning: containerSizeStruct not initialized in struct T_TEST_PULSE etc.
Can anyone help me how to solve this?
Matlab version 7.11.0.584 (R2010b), win32 Windows XP

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 16 Nov. 2011
In my experience, those "warnings" are almost always errors that will result in incorrect code being generated, so the only real solution is to ensure that containerSizeStruct is defined.
  3 Kommentare
Walter Roberson
Walter Roberson am 16 Nov. 2011
"The data retreived in the struct is oke." -- No, you simply have not noticed the errors yet.
The message you indicate corresponds to an absolute error in ANSI C (1989, 1999, and all Technical Corrigenda up through TC6 (2005) at least.)
There is a GCC extension that permits an moral equivalent under fairly limited conditions, but even that is expected to be coded quite differently.
But perhaps I am misunderstanding what the error message is saying.
Hilward
Hilward am 16 Nov. 2011
I'am going to find out who created the mex files to find out if it is possible to initialise them, I dont like unexecpected suprises.....
Thanxs for your help!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Kaustubha Govind
Kaustubha Govind am 16 Nov. 2011
It's not clear to me whether the warning is coming from MATLAB or the MEX-function. Assuming that MATLAB is throwing the warning, you need to first find the message ID of the warning. Use this command right after the warnings appear:
[warnmsg, msgid] = lastwarn;
msgid will contain the warning ID (say, TestEnv:InvalidInput).
You can then turn off this warning using:
warning('off', 'TestEnv:InvalidInput')
  1 Kommentar
Hilward
Hilward am 16 Nov. 2011
Thanxs for your fast reply!
It appears that the warning is from the MEX file because the WARNMSG which is displayed after LASTWARN is a previous warning.
Unfortunatly the Mex file is a generated file for me so I can't change it.
So, is there a solution to disable this external MEX warning?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Call C from MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by