Variable input vectors during the simulation in simulink

Hello,
I have generated a neural network model (in simulink).
It accepts only one column vector (Mx1) as an input.
I'd like to have different inputs and change them during the simulation, for example [1; 1; 1; 0; 0] and then [1; 1; 0; 1; 1] and so on, these i want to define in workspace. Simply more that just one column vector as an input during one simulation. What block I can use? And what exactly I should set? thank you

 采纳的回答

You can input the vector signal into the simulation simply using the constant block. If you want to specify the value in the workspace, then in the block dialog "Constant value" field enter c, and in MATLAB workspace define what c should be:
c=[1 1 1 0 0]
The output of the Constant block will be 5x1 vector. If you need to switch the inputs during the simulation, add another constant block, and use a Manual Switch block, or switch based on some logic using this block for example.
HTH.
Arkadiy

更多回答(1 个)

Thanks for response Arkadiy!
I did it just like that, but problem is, that I don't know how many input vektors I will have, can be 1, can be 8. In this case I was thinking about block "Signal from workspace" or smt like that. Because number of input vectors will vary each simulation. Unfortunately I was not able to set it properly...

类别

帮助中心File Exchange 中查找有关 Deep Learning with Simulink 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by