function output dimension in Simulink

11 visualizaciones (últimos 30 días)
Stefano Di Benedetto
Stefano Di Benedetto el 1 de Sept. de 2018
Editada: Naman Chaturvedi el 4 de Sept. de 2018
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

Respuesta aceptada

Naman Chaturvedi
Naman Chaturvedi el 4 de Sept. de 2018
Editada: Naman Chaturvedi el 4 de Sept. de 2018
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

Más respuestas (0)

Categorías

Más información sobre Simulink Coder en Help Center y File Exchange.

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by