0
votes

Here is my problem: We would like to use our different Simulink models within a script in a much faster way than having to open the Simulink environment (our MATLAB script using Simulink is launched many time).

For that purpose, I want to transform the Simulink model into a C version and launch it from a MATLAB script so that the process would be much faster than opening Simulink environment.

Does anyone have already tried this ? Is it possible ? It is unclear to me if I should try to construct an MEX-file from the C code generated with Simulink coder, or if I should use this coder.ceval function to directly run the C code ?

1
Are you doing some sort of Monte-Carlo testing? Are your tests "long" or "quick" to run? Is the problem with compilation time? What kind of output you need? The solution for your issue varies widely based on these details. For instance, you could use a shell escape command to run an executable depending on your IO architecture for this model. Or maybe you could try to prevent re-compiling while running the moel in rapid accelerator mode. Both are potential solutions to speed up your process (is speed your concern?) - Mefitico

1 Answers

0
votes

Not sure about the C code approach, but you could generate an executable using the RSIM target. This is relatively easy to implement and should speed up the execution. See Deployment of Simulink Models and Using RSim Target for Batch Simulations for more details.