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

8 次查看(过去 30 天)
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?

回答(1 个)

Viren Gupta
Viren Gupta 2018-10-24
编辑:Viren Gupta 2018-10-24
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

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by