# Simple Question on Simulink to generate an array of values

4 views (last 30 days)
Ash1992 on 1 Mar 2017
Commented: Sam McDonald on 8 Mar 2017
Hello Everyone ,
I feel that its really a dumb question to be even posted on forums. but i couldn't figure out the solution for simple problem which i am facing.
The Problem is I need to generate an array of values say [1:20] (or) [1:45] (or) [1:n] (or) even zeros(1,n) ,so this n varies for every time step (using discrete mode simulation)...
How would I get these values on simulink ???
Sam McDonald on 8 Mar 2017
Do you mean the array varies in size for each time step? If so, what are you trying to do?
If you are simply wanting to generate an array of values that stays constant for each time step, then you can use a Constant block.
From the documentation page for the Constant block:
The Constant block generates a real or complex constant value.
The block generates scalar, vector, or matrix output, depending on:
• The dimensionality of the Constant value parameter
• The setting of the Interpret vector parameters as 1-D parameter
The output of the block has the same dimensions and elements as the Constant value parameter. If you specify for this parameter a vector that you want the block to interpret as a vector, select the Interpret vector parameters as 1-D parameter. Otherwise, if you specify a vector for the Constant value parameter, the block treats that vector as a matrix.