From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

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
(2,949 Views)

Hello,

 

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

 

Michel

 

complex.png

0 Kudos
Message 2 of 6
(2,934 Views)

complex numbers.png

 

Ben64

0 Kudos
Message 3 of 6
(2,928 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
(2,926 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
(2,920 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
(2,882 Views)