LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

In range and coerce with complex numbers?

I have an array of complex numbers with these numbers I need to set to 0 all numbers whose real parts are negative. With "in range and coerce" I can split the array into real and imaginary then set all negative numbers to 0 then recombine the complex part but that still leaves me with 0+ai numbers that should be 0. How can I also set the complex part to zero for the negative numbers?

0 Kudos
Message 1 of 6
(3,156 Views)

Hello,

 

You can use the following fonction in a for loop with your array.

 

Michel

 

complex.png

0 Kudos
Message 2 of 6
(3,141 Views)

complex numbers.png

 

Ben64

0 Kudos
Message 3 of 6
(3,135 Views)

How would I arrange the two for loops to iterate over a 2d array? Sorry I'm quite new to labview.

0 Kudos
Message 4 of 6
(3,133 Views)

You should go through a basic tutorial, you will find plenty of them on NI website.

 

complex.png

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

 

You really don't need any loops.  Many LV functions that work on scalars also work on arrays.

cplx.png

"If you weren't supposed to push it, it wouldn't be a button."
Message 6 of 6
(3,089 Views)