Reputation: 153
I want to import a one dimentional array of the size 800000*1 into simulink from the workspace. However blocks like "Simin" require a 2-D matrix as input. Should I use another block? I get the following error when importing a vector using simin block:
Invalid variable specified as workspace input in 'G711decoder/From Workspace'. The variable is either a matrix or is a Simulink.SimulationData.Dataset object with an element containing matrix data. The matrix data must be a real, double, have two dimensions, and at least two columns. The first column must contain time values and the remaining columns the data values. Matrix values cannot be Inf or NaN.
Upvotes: 0
Views: 4668
Reputation: 115
You can use constant block for that.
Here First I created a variable as sample_matris (5x5) in workspace.
sample_matris = rand(5,5);
Here is the values created in workspace.
Then I used constant and entered name of the variable defined in workspace.
You can see that I can use values defined in workspace, by using constant block in simulink. If you need specific indices of the matris, you can use selector block in Simulink.
Upvotes: 0
Reputation: 84
I dont know if you are still interested in the answer. Simulink needs of a time vector, but if you just want to import a vector like: [2 12 -4 5] you just have to add a 0 at the begging:
[0 2 12 -4 5]
Is like saying that your vector only exist at time 0, you extract it from workspace use it, and then to call it again you will have to update the time on the vector, in other words the 0 becomes a 1 then a 2 then a 3 bla bla bla
Upvotes: 1