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

 채택된 답변

Arkadiy Turevskiy
Arkadiy Turevskiy 2012년 5월 8일
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개)

Vojtech Lavicky
Vojtech Lavicky 2012년 5월 9일

0 개 추천

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