How can I define variable output size of Matlab function in Simulink?

78 visualizaciones (últimos 30 días)
sdsd sdsd
sdsd sdsd el 9 de Dic. de 2019
Comentada: Nicolas B. el 10 de Dic. de 2019
I cannot define variable output size of Matlab function in Simulink. I got to "Edit Data" window, choose my output, tick the "Variable size" box, then define size as "1 N" where N is an variable from different script, and it does not work. Matlab shows message: "Size computation for 'y' failed. Unknown var 'N' used in size definition."

Respuestas (1)

Nicolas B.
Nicolas B. el 10 de Dic. de 2019
I also experienced that problem. When using the MATLAB Function block, I learned to always define the size of the inputs and outputs to avoid any trouble.
To do so:
  1. right-click on your block
  2. explore (it opens the Model Explorer directly at the right place)
  3. you should see the list of inputs and output of your MATLAB Function in the central part of the window
  4. For each variable:
  5. Click on it
  6. Set the variable size on the right part of the window
  7. Click on Apply button
  8. Once you have set all variables, you can close the Model Explorer and tada, it should work!
  4 comentarios
sdsd sdsd
sdsd sdsd el 10 de Dic. de 2019
Problem is that I have to use this option :/ Otherwise I will have to recreate my model basically from scratch using different method. While setting for example [1x24] everything is fine, but it would become complicated later on as model will be much more expanded.
Nicolas B.
Nicolas B. el 10 de Dic. de 2019
Than, you could refer to the answer given in this post:
Apparently, the answer worked.

Iniciar sesión para comentar.

Categorías

Más información sobre Interactive Model Editing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by