Create an array from the input of a MATLAB FUNCTION BLOCK

7 次查看(过去 30 天)
Hi,
I would like to create an array that contain the values of the input u that enter the MATLAB FUNCTION BLOCK
3.PNG
Trough the Simout the input is
4.PNG
but in the matlab code it enters a 1*1. I need to have the vector with the value of Data:1 in order to cycle on it.
2.PNG
in the last picture num is equal to 1. I need a way to create a vector with the value of u (4 5 1 5 3 1 2 1 5 5 2)
THANKS

回答(1 个)

Abhilash Padma
Abhilash Padma 2019-7-24
Hi,
I understand that you want to get an array as an output of MATLAB function block. But you are getting a value with 1x1 dimensions as an output of MATLAB function block. This is because every time a single value is passed as an input to the MATLAB function block. If you want to pass all values at a time into the MATLAB function block, One way is you can use the “Constant Block” and assign the vector as the value of the Constant Block.
  2 个评论
luca
luca 2019-7-24
The problem is that the vector is filled in a SIMEVENT process. I cannot substitute the ARGIN "Mescola" (that is the vector) with a costant block.
Maybe I've not clear what do you mean, may you explain better?
luca
luca 2019-7-24
编辑:luca 2019-7-24
I think that best choice whould be to "write something" in the MATLAB function script in order to report the vector and then use it to iterate in a for loop. But I have no idea of how to do

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by