Suppress warnings when using mexw32

5 ビュー (過去 30 日間)
Hilward
Hilward 2011 年 11 月 16 日
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

採用された回答

Walter Roberson
Walter Roberson 2011 年 11 月 16 日
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 件のコメント
Walter Roberson
Walter Roberson 2011 年 11 月 16 日
"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 2011 年 11 月 16 日
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!

サインインしてコメントする。

その他の回答 (1 件)

Kaustubha Govind
Kaustubha Govind 2011 年 11 月 16 日
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 件のコメント
Hilward
Hilward 2011 年 11 月 16 日
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?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCall C from MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by