C

Asked • 06/22/19

Matlab crashes with S-function after mdlOutputs?

I'm doing my "main" S-function based on the Matlab template with `mdlStart` `mdlOutputs`, etc, which communicates with some Ansi C files that I had, and this S-Function is used in Simulink. I compiled the files correctly with **mex** and in order to debug I'm using Visual Studio 2015. I can set and use breakpoints so everything is working fine. The problem is, after finishing 'mdlOutputs' function, where all the contents are correctly printed into Matlab the debugging goes into a breakpoint and it goes into 'simulink.c'. After that, the Debug is broken saying that "libmex.pdb" cannot be found. If I run the Simulink model without Visual Studio in the loop, Matlab just crashes and stops working. So, any idea on how to check properly where it is giving me an error? Also, do you have any clue on why the process crashes after leaving `mdlOutputs` and before entering `mdlTerminate`? What happens in-between these two functions? I'm using Windows 7, 64-bit and Matlab 2012b (I'm going to try and run it in the 2015b).

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.