LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to fix "size of the input matrices are incompatible"

I am currently receiving this error "The sizes of the input matrices are incompatible.  Verify that the matrices have the same size or that one is a scalar."

 

I have two matrices one is having 1 element in row and 200 elements in column. Other is having 1 row and 230 elements in column.

 

Can any body guide me how to fix this type of problem. I want to do the follwing operation on them (see attached image for details).

 

Is it suitable to convert them to scalar and perform that operation or make their size equal and then perform the required operation? Which one is more suitable please suggest and also please guide how to do it?

 

 

JK

 

diff.jpg 

0 Kudos
Message 1 of 3
(3,522 Views)

Obviously, the 2D arrays (not matrices!) are not of equal size, so you need to decide what you want to do. You can either trim the larger array to the size of the smaller one or pad the smaller array to the size of the larger one with a suitable value (e.g. zero).

 

If you would use plain LabVIEW instead of mathscript, the trimming would be automatic. Just subtract the two arrays and take the absolute value. No script node needed.

 

Since you only have one row, 1D arrays would be sufficient. Why do you use 2D arrays? Where is the data coming from?

Message 2 of 3
(3,514 Views)

josephkirmani wrote:

I have two matrices one is having 1 element in row and 200 elements in column. Other is having 1 row and 230 elements in column.


Those are 1D Arrays.  So let's treat them as such.

 

And as Christian said, just use native LabVIEW instead of the Mathscript.  Be warned that the output of this method will be the size of the smallest of the two arrays.  You will need to add padding if you want to result in the larger of the two arrays.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 3
(3,503 Views)