How to pass inputs to a Simulink executable launched in the cmd

8 views (last 30 days)
Hi everyone, I have a simple Simulink model consisting in a simple sum beetwen two inputs. I created, by using Simulink coder, the executable of this model and I want to launch it in the cmd by using a file Excel containing the two inputs of the sum. As output I want the result of the sum. Is it possible?

Answers (1)

Viren Gupta
Viren Gupta on 24 Oct 2018
Edited: Viren Gupta on 24 Oct 2018
If you have used rsim target, then you can follow the approach mentioned in the below link to add input arguments. https://www.mathworks.com/help/rtw/ug/rapid-simulations.html#brdeu57
1) Build the model with rsim.tlc as system target file
2) Collect parameters structure
>> param_struct = rsimgetrtp('myModel');
>> save myParams.mat param_struct;
3) If you wish to specify different input arguments:
>> param_struct = rsimsetrtpparam(param_struct,2);
>> param_struct.parameters{2}.values = [2 3];
>> save mymatfile.mat param_struct;
>> !myModel -p mymatfile.mat@2 -o rsim2.mat

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!