07-08-2014 01:34 PM
Hi,
Basically, the calculation i tried to do is called 'divide element by element'. It is a operation between two matrices with some cols and rows. The result matrix has also the same demension and every single element is obtained by dividing the element with same index in one matrix by the element with same index in another matrix. for examlpe,
A=[ 2 4 6
3 9 6]
B=[ 2 2 3
3 3 2]
the result will be
C=[ 1 2 2
1 3 3]
Is there any easy way to do this other than taking every single element out by using index array?
Many Thanks,
Hao Liu
Solved! Go to Solution.
07-08-2014 01:44 PM - edited 07-08-2014 01:55 PM
Use 2D arrays instead of matrix datatype, then simply use a plain division primitive. the operation will be done element by element automatically.
(Typically you should always use 2D array instead of the special matrix datatype. The matrix datatype is mostly useful for linear algebra)
(With matrices you need to be very careful, for example if you multiply two 2D arrays, you get an element-by-element multiplication, but if you do the same operation on two matrices, LabVIEW will substitute a true matrix multiplication, which is not the same. For the division, it seems that matrices are divided element-by-element, so it might work for you directly. You simply need to be aware that matrices are often handled differently. They are a very special datatype).