How to Solve Embedded MATLAB Interface Error: Error calling generated SFunction 'x_sfun'. Invalid MEX-file 'x_sfun.mexw32' is not a valid Win32 application.?

1 view (last 30 days)
I started by having a working .m function that I decided to port to simulink using embedded matlab function. At first I got several problems with the different types and sizes of my variables due to the restrictions of the embedded environment in order to be complient with C.
However when everything seemed solved and I tryed to run the simulation from Simulink I stopped having problems with variables but instead started to get this error:
Embedded MATLAB Interface Error: Error calling generated SFunction, SimulationGPS_sfun. Invalid MEX-file 'C:\Users\trrmsm\Documents\Karyon\Simulink_GPS\SimulationGPS_sfun.mexw32': C:\Users\trrmsm\Documents\Karyon\Simulink_GPS\SimulationGPS_sfun.mexw32 is not a valid Win32 application.
I've been searching in the forums for a solution and I've came accross dependency walker. At first I was missing severall .dll's but I managed to get all the .dll's that I needed. However the error in simulink still persisted and dependecy walker still gave the error:
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
I have no clue from which module is this error and I feel both error messages (simulink and dependecy walker) do not give any insight on how to solve the actual problem.
I've though about architecture problems since I am running Matlab 2010b SP2 32-bit on a 64-bit Windows 7 but I have no knowledge on the matter.
Can it still be a coding problem?
What can it be the origin of such problem?
Regards,
Rui M.
  2 Comments
Kaustubha Govind
Kaustubha Govind on 3 Oct 2013
Was the MEX-file produced on the same machine that you are running the model on? Could you try re-running the mex -setup command to setup the MEX compiler again, delete the slprj folder and the file SimulationGPS_sfun.mexw32 from your working directory, and try running the model again.

Sign in to comment.

Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!