Series block connection without copying blocks - matlab

I have a model with n blocks connected in series (And last (nth) block's outputs are connected to first block inputs). Only difference among them is the parameter's value (first array element in matlab is value for first block's parameter, second value for the second block and so on). How can I implement it without explicitly copying blocks? What I have now:
I want to have this:

Related

Store signal values, output as vector for function input

Im trying to do some calculations in a Matlab (R2015b) Simulink function block. I use a signal that gives discrete values in 1-minute intervals.
What i want to do is store the signal values of 1 day (1440 values), convert them into a vector and input it in my Matlab function for calculation (getting time between first and last value > x). All while the simulation is running.
Unit delay, and Transport delay blocks wont work because i need all the stored values at once.
Any ideas on this are much appreciated!
Thanks!
You need to add a "To Workspace" block to your simulink diagram. Setting the options as you wish will allow you to save all the outputs in a single vector. You can select the variable's name, and the default is "simout".
Then, after running the diagram, you have the variable you want in the workspace (as if you had typed it in the console). So next, you can call your function with the argument.

Simulink: Indexing from a Constant block with array

I could swear that I have seen a constant block in Simulink with a vector in its value field and that the effect was that on each simulation time step, Simulink would index the next value in that array and output it on the Constant block's output (see picture below). So the output of the constant block (in the picture below) would be 1, then 2, then 3, then 4.
However, the effect is (regardless of the value of "interpret vector parameters as 1-d"), that only the first value in the Constant block's array is output from it.
I'm I mistaken? What am I doing wrong?
You haven't seen the Constant block behave that way, because it doesn't behave that way. If you want the signal to change then you need to use a block that allows/forces you to also specify a time vector of points indicating when the input values change, such as something like the From Workspace block.
The way you have your model set up, the Constant output is a 4 element vector, as is the output of the Product block.
Also, as per the image you have shown, you are not seeing "that only the first value in the Constant block's array is output from it". The viewer clearly shows that you are viewing the value of Constant 1(1,1), that is the first element in the signal. The other 3 values output from the constant block and the Multiply block are clearly indicated in the viewer, you just haven't selected them for viewing.

Does Simulink have a Compare to Constant block with the constant defined outside the block?

Consider Simulink's Compare to constant block.
The constant to which you are comparing the input signal, has to be set in the Function block parameters window (double click on the block). Is there an other block that compares two input signals, namely the previously mentioned input signal and a constant (in this case 5)? Because of the fact that the constant is no longer a parameter but an external signal, this would be useful to combine with a from block.
Or does this alternative block not exist because you could actually check if the difference between two signals is smaller than or equal to a constant with a compare to zero block?
The Relational Operator block...

How to import arrays of data into Simulink

I want to import several arrays of data into Simulink so that I can cycle through each of those arrays, operating on one column at a time, and choosing a different array at random intervals. (So let's say I start cycling through the columns of array 1 for 1 second, then I'll move over to array 2, then array 3 and back to array 1).
I can't use From File blocks because each column then has a specific timestamp associated to it, so I can neither cycle, nor start the simulation selecting a different array each time.
Is there a solution to this problem in Simulink?
Use a MATLAB Function Block. Have your array input to it as a Parameter, which means it'll pick the whole array up from the MATLAB Workspace during model initialization.
Depending on how you want to index into the matrix -- you haven't given enough information to determine this -- you could either,
have 2 signals input to the MATLAB Function block that represent a row index and column index. You'd then have logic in the model that specifies these signal/index values.
have 2 persistent variables within the MATLAB Function block that define the row and column indices. Have logic in the block that specify how these variables change each time step.

changing value of parameter not given in input ports with each loop iteration in simulink

Can anybody tell me how to change value of a parameter which is not given in input ports of that block during each iteration of 'while' or 'for' loop in any block in simulink for example, if i want to plot 'throughput' against 'SNR' which is a parameter in 'awgn channel' block (which takes only data to be transmitted as input, I change 'SNR' parameter manually) how can it be done automatically with loop iterations?