Showing results for 
Search instead for 
Did you mean: 

Matrix dimensions don't agree when sending 1D array inputs to MATLAB Script node within Labview



I am using three 1D arrays (frequency, real S11 data and imaginary S22)  to send to the MATLAB scipt node inside Labview.

MATLAB script node uses a predesigned MATLAB code to process that data into matrices. I cannot post the code because it's not my own, however the code uses a lot of matrices and all that stuff to process these.


Before checking in Labview, what I did was store these three arrays as three different variables in MATLAB. Then I just ran the code which accepts these variables and gives Q. In such a case, the code worked perfectly fine. However when I use the same data and send it to MATLAB script node in Labview, it says 'Matrix dimensions must agree'

I think it is because when Labview sends that array, it actually has two columns, one is serial number and other is the data, because whenever I opened the write to measurement file, there were always two columns not one which MATLAB needs probably.

Is there a way to remedy this problem?

0 Kudos
Message 1 of 3

If it is two columns, it  is not a 1D array.

MATLAB makes a distinction between row vectors and column vectors, maybe that's the problem.

0 Kudos
Message 2 of 3

I sorted that out. It was because those 1D arrays were saved as horizontally in rows so I transposed them.

Can you tell me if MATLAB script embedded in Labview modules can call functions?

So far I have not been able to call any and am pasting code all over the place. It always shows errors.

Or which directory does the functions have to be?

0 Kudos
Message 3 of 3