LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Matrix Dot Product

Hi,

 

Anyone here can help me transforming this Matlab code to LabVIEW?

 

varA.*varB

 

varA and varB is a 2D array.

 

Thanks....

0 Kudos
Message 1 of 6
(5,785 Views)

Look at this thread, which goes over a similar issue. You can also look at the following resources: 

 

Working with .m Files in LabVIEW for Text-Based Signal Processing, Analysis, and Math

 

Hope this helps. Good luck!

 

~kgarrett

 

District Sales Engineer
0 Kudos
Message 2 of 6
(5,764 Views)

Modern LabVIEW has a "Matrix" data type (look for it on the Array palette), which supports such things as Matrix Multiplication (you just multiply the matrices).  If you really want to incorporate Matlab code into LabVIEW, you can do that, as well, but you can also just "do it natively" in LabVIEW.

0 Kudos
Message 3 of 6
(5,751 Views)

I am not sure why you call this thread "dot product", because the dot product is typically defined for vectors (1D arrays) and not for 2D Arrays. Can you clarify what result you expect? Is one of the dimensions of your 2D arrays guaranteed to be of size=1?

 

0 Kudos
Message 4 of 6
(5,747 Views)

Actually the operation you are showing is the simple element-by-element multiplication operator.  You can simply feed 2D arrays to the multiplication primitive and you will get the result you are expecting.  If you use matrices instead of arrays, LV will cleverly substitute the matrix multiplication function, but give you no visual indication (now you can double click on the icon).

 

ArrayMultiplication.png

Message 5 of 6
(5,739 Views)

Darin,

 

     Oops, I forgot that the Matlab dot-star operator is, indeed, element-by-element multiplication, analogous to the inner product of vectors!  Thanks for clarifying this!  It is still good to see that, if you know what you want to do (e.g. multiply two matrices or do element-by-element multiplication of two 2-D arrays), there's a native and intuitive way to do it in LabVIEW.

 

BS

0 Kudos
Message 6 of 6
(5,724 Views)