Matlab function Interface Error

22 visualizzazioni (ultimi 30 giorni)
I have a function which accepts 2 inputs (scalar) and outputs an array of values. I have to use this in Simulink by using the Matlab Function block. The input value can vary and the output array size depends on that. This function is for Curve generation (computing an integral using trapezoidal approximation). I did define the outputs as variable size using the ports and data manager, and also by 'coder.varsize'. However this error still remains. Does anyone has any idea?
MATLAB Function Interface Error: Unable to propagate the variable-size mode from the input 'MATLAB Function' of 'MATLAB Function'. This input expects a fixed-size mode. The variable-size mode originates from 'trapapprox_clo/MATLAB Function/ SFunction '. Examine the configurations of 'MATLAB Function' for one of the following scenarios: 1. The block does not support variable-size signals 2. The block supports variable-size signals but needs to be configured for them. You can enable variable-sizing for 'MATLAB Function' from the ports and data manager dialog.

Risposta accettata

Kaustubha Govind
Kaustubha Govind il 26 Giu 2013
Signals that change size during simulation are called variable-size signals in Simulink. You need to configure your MATLAB Function block's output as a variable-size signal and specify the maximum possible (upper bound) size of the signal in the Ports and Data Manager, since Simulink does not support dynamic allocation of memory, and uses the upper bound to allocate memory for the output instead. Please see
  1 Commento
kukke swaroop
kukke swaroop il 26 Giu 2013
Yes i read your previous answers on this error before posting this question. As i said, i did configure my output ports as variable size and giving the maximum upper bounds using the ports and data manager. But the error is still prevalent. I also tried with "coder.varsize" inside the function. But its not working.

Accedi per commentare.

Più risposte (1)

kirteekumar sonawane
kirteekumar sonawane il 23 Ago 2018
Modificato: kirteekumar sonawane il 23 Ago 2018
I also faced same issue. after reading hint from my professor. (DI-Fh Mr. Raul Estrada) I got the solution. In addition to what is written above, you'll need to insert assert(var<=12); var: Your variable sized variable. and remember to give upper bound in assert (not lower bound).

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by