function output dimension in Simulink

13 ビュー (過去 30 日間)
Stefano Di Benedetto
Stefano Di Benedetto 2018 年 9 月 1 日
編集済み: Naman Chaturvedi 2018 年 9 月 4 日
Hi everybody, i'm using a matlab function in Simulink in order to solve an optimization problem: to this purpose, i have as inputs in my function both matrix and constant values. In the function I extract a matrix index (corresponding to a minimum value) and than i use this index to get a value from a vector, so that i should have my scalar output value. Now, if I run the function code by command windows, it works well and give as output a scalar value, but if i run the code inside a Simulink function i have this error:
"Data 'T2_target' is inferred as a variable size matrix, while its properties in the Model Explorer specify its size as inherited or fixed. Please check the 'Variable Size' check box and specify the upper bounds in the size field"
(where T2_targer is my output);
I can't understand this kind of error.
Thank you

採用された回答

Naman Chaturvedi
Naman Chaturvedi 2018 年 9 月 4 日
編集済み: Naman Chaturvedi 2018 年 9 月 4 日
Hi Stefano,
The error occurs because your MATLAB function provides the output of a variable-size but, as defined in the Model Explorer, it is of fixed size, or it inherits its size. You can simply take care of this error by checking the "Variable Size" checkbox in the model explorer and specify the upper bound. To do so, open your MATLAB function in the editor, then select EDITOR->Edit data, select output variable, check the variable size checkbox and specify the limit range of your output.
HTH

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink Coder についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by