02-04-2014 04:50 AM
Is there really no operator for this in LabView? or am I blind?
Using the standard "multiplication", like A*B, labview performs AxB. But I want element wise multiplication, like if when you multiply two 2D arrays together.
The element wise matrix multiplication is called for the Hadamard product.
(and yes, you can code it yourself, but I just cant find to seem any operator for it, just want to know if I am blind or not!)
02-04-2014 05:47 AM
You could try converting to arrays, multiplying and converting back to matrices. Not the ideal answer, I know.
02-26-2014 06:47 AM
Hi,
Using the regular Multiply function should give you the per-element multiplication. Please view this KB for an example on matrix multiplication: http://digital.ni.com/public.nsf/allkb/862567530005F09C862566F400818DC0
A snippet of the file is attached below:
Kind regards,
11-24-2014 04:23 AM - edited 11-24-2014 04:24 AM
This does not work however if the input is a matrix (RealMatrix.ctl). In that case, the multiplication is not elementwise but performs matrix multiplication instead. So far, using a formula is the only workaround I figured out. Any ideas?
11-24-2014 10:11 AM
You can convert the matrix to a 2D array before the multiplication. this is just a very cheap typedef change and is done in place.
11-26-2014 02:48 AM - edited 11-26-2014 02:51 AM
Thanks. Yes, in fact, converting the matrix to a 2D array and then using the multiplication is almost twice as fast as multiplying matrices using formulas.