How do I generate grt code with a global parameter in the Index of the Selector

1 view (last 30 days)
Hi,
I would like to generate the grt.tlc code for a model that inludes Selector. The index of the Selector is defined using a variable/parameter, which is desirably to be included in the Global parameter -> Setting/Optimization/Signal and Parameter/Configure. I am receive a error message if I am trying to generate the code with this variable defined in the Global parameter. I don't need it to be tunable during runtime, but need it for initialization. How should I setup the congifuration? An example is attached.
### Starting build procedure for model: untitled_v4_nontunablePara
Code Generation 1
Elapsed: 0.360 sec
### Build procedure for model: 'untitled_v4_nontunablePara' aborted due to an error.
For dimensions 1: invalid setting in 'untitled_v4_nontunablePara/Selector3' for parameter 'Indices'.

Answers (1)

Shiva Kalyan Diwakaruni
Shiva Kalyan Diwakaruni on 17 Dec 2020
Hi ,
To initialize variable first you can -
1)open the model explorer
2)Go to Model Workspace
3)choose matlab code from data source drop down
4)type nb_Cap=30;
5)give nb_Cap as argument in Model Arguments text box.
6)click apply
7)generate code
hope it helps,
thanks
  1 Comment
And Meng
And Meng on 17 Dec 2020
Thank you Shiva for your answer. I think I did not make it clear. I need a blackbox where the value of nb_Cap should be specified at the mask of the blackbox. The method you have mentioned would make nb_Cap to a fixed value and can no longer be changed.

Sign in to comment.

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products


Release

R2015b

Community Treasure Hunt

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

Start Hunting!