LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

elements in a matrix

Hi,

I have a matrix A=[2 1 -1;-1 5 -2;-2 -4 -5;1 2 3], and I would like to determine the every element in A in LabVIEW. If the element is 

 

greater or equal to zero, I will change the element to 1. Otherwise, the element is changed by -1. In other words, the new matrix should be B=[1 1 -1;-1 1 -1;-1 -1 -1;1 1 1] based on the rules before. Does anyone help me?

 

Thanks,

 

POPo

0 Kudos
Message 1 of 3
(2,333 Views)

If you don't really care about zero, use the Sign function from the numeric palette, else add a little more code. 🙂

 

 

Message Edited by altenbach on 06-19-2009 05:50 PM
0 Kudos
Message 2 of 3
(2,330 Views)

If you don't want zeroes in the output (as originally specified), you could do as follows:

 

Message Edited by altenbach on 06-19-2009 05:55 PM
0 Kudos
Message 3 of 3
(2,327 Views)