Suppress warnings when using mexw32
6 views (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
Walter Roberson
on 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 Comments
Walter Roberson
on 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.
More Answers (1)
Kaustubha Govind
on 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')
See Also
Categories
Find more on Call C from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!