Implementing multiple simulation state /group of parameters for Simulink model (Embedded coder)

Good morning,
I have a model for which I require a standalone executable. I generated it using the embedded coder, but, It works just for one working point, corresponding to the workspace available when generating the code.
My issue is that, the code should stop when a certain condition is met, and restart other 2 times, with a different set of parameters.
I achieved that in pure simulation using a matlab script to set the parameters using a for each and starting the simulation using matlab command.
How could I handle that without relying on matlab, but just on simulink?

3 Comments

Could you share the model file so that this issue can be accurately reproduced? Also, you can consider implementing the different working points as independent resettable subsystems.
This link describes an example model which uses resettable subsystems - https://www.mathworks.com/help/simulink/slref/resettable-subsystems.html.
Here is more information about resettable subsystems - https://www.mathworks.com/help/simulink/ug/reset-block-states-in-a-subsystem.html.
Hope this helps!
Due to its intended use in a future product, I cannot share the Simulink model directly. Currently, each operating point requires a separate resettable subsystem, and each use-case scenario is defined by a distinct MATLAB script, leading to different workspaces at executable generation.
My goal is to enable runtime modification of these parameters, ideally through C code integration or a Simulink feature. For instance, consider a scenario where a certain material thickness is reduced from thickness_1 to thickness_2. Upon completion of the process, the system should reset, initializing thickness_1 to thickness_2 and thickness_2 to the subsequent target thickness_3.
While I've implemented a MATLAB script-based reinitialization triggered upon simulation termination, I need a completely standalone solution, "MATLAB free".
I also contacted the Matlab Support and they suggested to review this page for code generation interface :How can I create an executable from my Simulink model to send to someone who does not have MATLAB? - MATLAB Answers - MATLAB Central
But still to me is not clear how to tell the software to reload the parameters at runtime, and how to define from where the .exe should read them.

Sign in to comment.

Answers (0)

Categories

Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange

Products

Release

R2024b

Asked:

on 3 Apr 2025

Commented:

on 15 Apr 2025

Community Treasure Hunt

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

Start Hunting!