Is possible to access to a MAT-file during the HIL simulation?

1 view (last 30 days)
Hi, I'm developing a target for a especific hardware. I generate a dll I need to acces to a MAT-file located in the same hardware to change some variables during the simulation. I have seen the files 'matdgns.c' and 'matcreat.c'. But I don't know how can I run this code in my hardware. Thanks in advance
  7 Comments
Kaustubha Govind
Kaustubha Govind on 10 Sep 2013
Carlos: If you're writing a DLL independent of MATLAB to access the MAT-file, I don't understand why you have included simstruc.h - which is why I was asking if your DLL is an S-function.
Carlos
Carlos on 11 Sep 2013
My dll is not independent of Matlab. I generate it with Simulink Coder and Embedded Coder, and during the dll compilation the file 'simstruc.h' is included by 'rt_sim.c' in the line 32

Sign in to comment.

Accepted Answer

Kaustubha Govind
Kaustubha Govind on 11 Sep 2013
It appears that you are integrating MAT-file reading/creation code into code generated from Simulink Coder. Would it be possible to put the MAT-file related code in a separate C-file, so you don't see clashes between simstruc.h, and mat.h and matrix.h? I think you can "extern" the MAT-file function from the other C-file and call it from the file generated using Simulink Coder.
  6 Comments
Carlos
Carlos on 17 Sep 2013
I have read this document. But when I try to implement it I have this error:
Error: Simulink Coder does not support both External Mode and the C API at the same time.
And I can't clear the external mode due to my requeriments
Kaustubha Govind
Kaustubha Govind on 17 Sep 2013
Carlos: Sorry, this is beyond my expertise. You could try posting a new question or contact MathWorks Tech Support.

Sign in to comment.

More Answers (0)

Categories

Find more on Simulink Coder 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!