06-19-2009 07:38 PM
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
06-19-2009 07:49 PM - edited 06-19-2009 07:50 PM
If you don't really care about zero, use the Sign function from the numeric palette, else add a little more code. 🙂
06-19-2009 07:55 PM - edited 06-19-2009 07:55 PM
If you don't want zeroes in the output (as originally specified), you could do as follows: