LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Fastest way to compute C(i,j)=max(A(i,j),B(i,j))

Solved!
Go to solution

Hi Ppl,

I just wanted to know, what could be the fastest way to pick the maximum element from a 2D array .

That is i want to implement C(i,j)=max(A(i,j),B(i,j))

I do not want to index each element and select the maximum of two, as it would take more time to execute.

I tried the below method to implement this. The problem with this is, when a NaN is passed as input, NaN is returned

as output, irrespective of the other input. I don not want this to happen.

Can any one suggest a better method to implement this...? 

 

 

0 Kudos
Message 1 of 5
(2,775 Views)
Solution
Accepted by topic author lordsathish
Use the Max and Min primitive from the comparison palette. It accepts arrays and will even ignore NaN.

___________________
Try to take over the world!
0 Kudos
Message 2 of 5
(2,767 Views)
Use the Max & Min function node. Not really sure of what the O(n) of that function is.
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 3 of 5
(2,763 Views)

However the max/min of (NaN, NaN) ist still NaN !

So you still have to look for that case 😉

 

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 4 of 5
(2,758 Views)

Hi Ppl,

What makes such a difference in the execution speed, when we use a function from LabVIEW and use our own VI.

Is it that these functions are precompiled makes such a difference, or that they are done efficiently ?

I guess both should be the reason that they their execution times are less.

 

Thanks 

0 Kudos
Message 5 of 5
(2,692 Views)