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

조회 수: 1 (최근 30일)
And Meng
And Meng 2020년 12월 14일
댓글: And Meng 2020년 12월 17일
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'.

답변 (1개)

Shiva Kalyan Diwakaruni
Shiva Kalyan Diwakaruni 2020년 12월 17일
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
And Meng
And Meng 2020년 12월 17일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

제품


릴리스

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by