LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

And elements in an array

Hello!

I have a maybe small problem for you... I want to make and between elements in an array. In the attached VI I have a 2-dim array with 5 columns and then I want to pick out each column and make and between the elements. When the next number in the row of the column is zero there should not be any and-operation. (Cause then it all becomes zero). This number that comes out of this operation I want to place in the array on the corresponding place to the column that one can see to the right of the for-loop (indicator). I only get zeros out to the array... Shall I use shiftregister or something? Anyone who has an idea what I am doing wrong? Thank you and best regards.
0 Kudos
Message 1 of 7
(3,145 Views)
Hello,

First of all, the algorithm is not returning only zeroes - if you try it with a column filled with '1' it will return '1'.
Second wire the first element of the array to the shift register instead of 1 - 1 is otherwise you are already starting with 1 witch is not correct.
And third - I don't understand the comparision you are making in the beginning - you are cheking if the f~irst element of the column is zero - you should check if any element is zero - Check the search array function.

Hope this helps,
Paulo
0 Kudos
Message 2 of 7
(3,139 Views)
Hello!

Thank you for your answer. Yes that is the problem... I first check if the element 0 is zero. Then because of the previous section in my program I know that there is nothing in that column. But if there is one column that begins with "not zero" then I want to make and between the elements until there is an element that is zero. Now I have figured out how to solve this... if anyone is intrested in looking at the attached VI. Maybe there is a better way to solve this problem? One could perhaps get rid of the first check if the first element is zero but then one get out the number 2047 in the array when I want it to be zero... (what I am doing is to check which of 11 bits that is set)

Ooops!! Now I see that I forgot to set "make current value default"!! Now I have changed this bit 😛 Sorry...
0 Kudos
Message 3 of 7
(3,134 Views)
Hello,

Take a look at the following approach:

Hope it helps,
Paulo
0 Kudos
Message 4 of 7
(3,130 Views)
You can definitely simplify your code a little bit. (See attached, LV 7.1)

For example, if the first element is zero, the search array returns zero and thus give you all information. You don't need to seperately check it.
0 Kudos
Message 5 of 7
(3,110 Views)
Hello!

Thank you for your answer! But what if I have for example 2,3 in column 4 and 0,2,3 in column 5? Then one get out zeros everywhere anyway... or am I doing something wrong when I run your VI? This is the problem I have, that I do not want to do and with the zeros, because then one get zero out... I only want to do and where there are numbers... thank you for your answer anyway 🙂
0 Kudos
Message 6 of 7
(3,095 Views)
Hello!

This is how I almost did at the end... but the VI where one transpose the columns was a good idea!! Thank you for your kindness and your help!

Best regards!
0 Kudos
Message 7 of 7
(3,094 Views)