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 CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by