LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Finding the total number of Trues before and after each false in a boolean array

Solved!
Go to solution

the first F should return 3, 6.... but I'll take both examples from you if you have em...Could be useful to me as I am still learning

0 Kudos
Message 11 of 33
(1,341 Views)
Solution
Accepted by topic author ritch_by_nature

Here's all you probably need.

 

 

 

(you have a lot of very questionable code in your snippet above, for example a not equal comparison with an array that is all TRUE is the same as a "not", delete that array constant. Your sequence frame has no purpose. You cannot stop your VI, etc.

Download All
0 Kudos
Message 12 of 33
(1,334 Views)

Thanks you so much!

0 Kudos
Message 13 of 33
(1,324 Views)

Actually I found a bug in iit doing some heavy testing where If I set up many configurations of falses and trues. It does not count up to the next false.. .

for example, in the attached code. I have 0,1 set to true then 6,7 true.. when it is counting the number of true before element 2. It should be 2. but for the element after it should be  2 as well. Instead it read all the true that comes after and gives 14.

Same code was already posted.. no modification was made.

0 Kudos
Message 14 of 33
(1,318 Views)

Currently on the bus and cannot test, but make sure there are no hidden array elements. For example just resizing the container  to show fewer elements does not make the array smaller. Show the array scrollbar to make sure.

0 Kudos
Message 15 of 33
(1,304 Views)

Actually im using your raw vi with no modification. if you look at png version you will see the results is on the first row for the fisrt false "after false is 15.  It should just be one because it should not count all the trues after but all the true until you reach the next false.. same rules apply for "before false as well"

0 Kudos
Message 16 of 33
(1,297 Views)

You are contradicting your earlier statement where you said that the example in message 8 should return 3,6.

0 Kudos
Message 17 of 33
(1,294 Views)

My mistake.. I meant to say 3.3 but I will take 3.6 as a plus as well. But it should be 3,3

0 Kudos
Message 18 of 33
(1,291 Views)

Please do NOT re-post my code already posted earlier. It is NOT your code! You can always link to my earlier post if a reference is needed.

 

You already have my version that would return 3,6. It should be simple to modify it to return the other alternative. Try it. 😄

 

 

0 Kudos
Message 19 of 33
(1,283 Views)

I tried honestly.. but I'll keep trying...

0 Kudos
Message 20 of 33
(1,278 Views)