2
votes

I have built a simulink model for a prototype I am trying to build.I want to test this model by applying data of a signal to the simulink model and I used the (from workspace) block to enter the data to the model but this error appear "Error in port widths or dimensions. Output port 1 of 'model23/Subtract' has 23999 elements. This port does not accept the dimensions (or orientation) specified by the output signal." I attached the model and need to know what is wrong with it.![enter image description here][1]

1
Where's the attached model/image ? - P0W
I tried to attach the image ,but it did not work - Emy Lotfy

1 Answers

1
votes

Simulink is trying to read the data as a series of parallel signals (like the output of a mux), which every block will then try and act on as that (including the subtract block the error message refers to).

If you have a row vector a = 1:10 in your workspace, and refer to a in the "From Workspace" block, then Simulink will take the first column (1) as the timestamp, and the rest as the data (9 parallel signals - output them to a scope to see it easily).

If you want to use a variable in your workspace called simin, and you currently have your variable data, then the following will convert it to a matrix where the first column is a timestamp and the second column is the data:

lenA = length(data)
simin = [(1:lenA)' data']