Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Simulink error: 'Error while obtaining sizes from MEX s-function'...

199 views
Skip to first unread message

Kate J.

unread,
Aug 11, 2010, 4:42:04 PM8/11/10
to
I had my system of files (which include Simulink models as well as xPC Target) up and running on my previous PC; then, the PC died, and I had to transfer everything over to a new PC. Now, when I try to run these same files/models that had previously worked, (specifically, the Simulink model that runs on my Host PC, using xPC Target; I call this my "Host model"), I get the error message:
.......................................
Error while obtaining sizes from MEX S-function 'controller_CMEXsfcn' in 'Host_model/S-Function'. MATLAB error message:

Invalid MEX-file 'C:\research_project\8-01-10\mymexfile.mexw32': This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.
.........................................
I have deleted the previous mymexfile.mexw32 from my working directory and rebuilt it, as I figured that it might need to be built on the new PC; however, this hasn't resolved this error.

What might be the problem? If the mex file cited in the error message *is* located in my working directory, and it worked on my previous PC, why does the error message now say that my mex-file is 'invalid'?

Thanks for any input anyone has.

Robert

unread,
Aug 11, 2010, 4:57:04 PM8/11/10
to
"Kate J." <quisq...@hotmail.com> wrote in message <i3v1us$ldg$1...@fred.mathworks.com>...

An S-Function "controller_CMEXsfcn" would usually call mdlInitializeSizes from some controller_CMEXsfcn.mexw32 but from mymexfile.mexw32. Maybe you provide us with the code from controller_CMEXsfcn:mdlInitializeSizes or whatever you really run. If you're not allowed to, you must reproduce the problem with some neutral example model/code and post it.

Chears,

Robert

Kate J.

unread,
Aug 11, 2010, 5:14:04 PM8/11/10
to
Oops, my mex file's name is actually 'controller_CMEXsfcn.mexw32', not 'mymexfile'; I had changed the name in the latter part of the error message to simplify things, but forgot to change it at the top of the error message.

Does that change anything?

Kate J.

unread,
Aug 11, 2010, 5:37:04 PM8/11/10
to
To clarify my last post, here is my actual error message:

Error while obtaining sizes from MEX S-function 'controller_CMEXsfcn' in 'Host_model/S-Function'. MATLAB error message:

Invalid MEX-file 'C:\research_project\8-01-10\controller_CMEXsfcn.mexw32': This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.

Kate J.

unread,
Aug 11, 2010, 5:39:04 PM8/11/10
to
Thanks for your input, Robert. I will take a look at the mdlInitializeSizes code in the mex file. However, I'm puzzled why this same, unaltered code would run fine on my previous PC, but now fail on the new one... weird.

Robert

unread,
Aug 12, 2010, 3:13:07 AM8/12/10
to
"Kate J." <quisq...@hotmail.com> wrote in message <i3v59o$qmd$1...@fred.mathworks.com>...

> Thanks for your input, Robert. I will take a look at the mdlInitializeSizes code in the mex file. However, I'm puzzled why this same, unaltered code would run fine on my previous PC, but now fail on the new one... weird.

Looks like you're still running an old dll. Running "which('controller_CMEXsfcn', '-ALL')" could possibly give a hint. If you run the newly built mex your matlab and mex-compiler installation must be fixed, see "Solution 1-2223MW" on the mathworks homepage:
http://www.mathworks.com/support/solutions/en/data/1-2223MW/?solution=1-2223MW

Cheers,

Robert

Steve Amphlett

unread,
Aug 12, 2010, 3:41:21 AM8/12/10
to
"Kate J." <quisq...@hotmail.com> wrote in message <i3v560$jkg$1...@fred.mathworks.com>...

> To clarify my last post, here is my actual error message:
>
> Error while obtaining sizes from MEX S-function 'controller_CMEXsfcn' in 'Host_model/S-Function'. MATLAB error message:
>
> Invalid MEX-file 'C:\research_project\8-01-10\controller_CMEXsfcn.mexw32': This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.

It looks like your MEX file has dependencies that are not on the new computer. Most likely MSVC++ run-time libs. The mex function spews a warning about installing the right run-time libs on any machine that needs to load & run a MEX file.

Kate J.

unread,
Aug 12, 2010, 11:37:24 AM8/12/10
to
Thanks for your input, Steve. I used Dependency Walker to investigate the dependencies, and found 4 missing DLLs. I will try to figure out how to find these, as not all of them seem to be on my old PC's hard drive...

Steve Amphlett

unread,
Aug 12, 2010, 11:53:06 AM8/12/10
to
"Kate J." <quisq...@hotmail.com> wrote in message <i414fj$m1p$1...@fred.mathworks.com>...

> Thanks for your input, Steve. I used Dependency Walker to investigate the dependencies, and found 4 missing DLLs. I will try to figure out how to find these, as not all of them seem to be on my old PC's hard drive...

You will need to find an appropriate vcredist_x86.exe or vcredist_x64.exe from the Microsoft website. The version you need will depend on what compiler version built your MEX file.

Here is a TMW technical solution for VS2005-compiled MEX files. It may not be the exact answer, but it is the same problem.

http://www.mathworks.com/support/solutions/en/data/1-2223MW/

Jonghun

unread,
Apr 25, 2013, 1:12:08 AM4/25/13
to
"Kate J." wrote in message <i414fj$m1p$1...@fred.mathworks.com>...
> Thanks for your input, Steve. I used Dependency Walker to investigate the dependencies, and found 4 missing DLLs. I will try to figure out how to find these, as not all of them seem to be on my old PC's hard drive...

I got a similar problem on my Windows platform,
And I fixed it by finding missed dlls and putting them in correct location.
Finally it worked.

I wanna thank to Steve for giving me a right insight for getting the solution.
And I just post to let you, who maybe have some trouble with this, know about a
candidate solution.

Harish kumar

unread,
Apr 25, 2013, 10:05:08 AM4/25/13
to
"Steve Amphlett" <Firstname...@Where-I-Work.com> wrote in message <i408j1$4vc$1...@fred.mathworks.com>...
If you do not mind..please...help me http://www.mathworks.com/matlabcentral/answers/73552-how-can-i-get-rid-of-the-error-reported-by-s-function-scominterl-in-work1-lte-turbo-encoder-rand
0 new messages