LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate an array from a boolean indicator

Hello, 

 

I have a boolean indicator in my program which changes turns on and off every time a task is successful and unsuccessful respectively. I want to create a boolean array from this indicator such that every time the indicator changes value, it is recorded in the array. Can this be done? Could anybody please suggest a way to do this?

Thank you. 

 

 

 

 

0 Kudos
Message 1 of 7
(4,438 Views)

What is "recorded"? How many elements? Do you want the array elements to turn on in sequence?

 

Please explain.

0 Kudos
Message 2 of 7
(4,428 Views)

Is your Task in a loop?  Do you have a Boolean output that is True if the Task was successful and False if it was not successful?  Do you have any experience with Arrays?  Have you looked at the Array Palette and looked at the functions there?  Do the names of any of those functions suggest creating arrays?  And if you aren't sure what they do and how they work, have you used the LabVIEW Help to get detailed information on them?

 

Do you know how While and For loops treat Arrays?  Does the term "Indexing Tunnel" mean anything to you?

 

You should be able to figure out this problem all by yourself, simply by looking up Arrays, Array functions, and re-reading the description of how LabVIEW's Loop structures treats Arrays.  Give it a try.  If you figure it out for yourself, it will "stick".

 

Bob Schor 

0 Kudos
Message 3 of 7
(4,391 Views)

If it only logs when the value is changed i'll bet money on that every 2nd one will be True and False resp. 🙂

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 4 of 7
(4,344 Views)

@Yamaeda wrote:

If it only logs when the value is changed i'll bet money on that every 2nd one will be True and False resp. 🙂


Yes, ultimately the array will be of infinite length, but very (very!) boring otherwise. ;).

The original problem still does not make any sense to me. We need clarification.

Message 5 of 7
(4,336 Views)

@altenbach wrote:

Yes, ultimately the array will be of infinite length, but very (very!) boring otherwise. ;).

The original problem still does not make any sense to me. We need clarification.


If i would guess, it'd make more sense to log with timestamp when such a change occurs, in which case it's not the boolean that should be logged, but a time stamp and the boolean. If the log continues after restart you might even get several True in a row (assuming it also logs the start up).,

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 7
(4,304 Views)

Here is an VI that maybe does what you are looking for (I hope so...)

 

I think that the key point is to use a shift register (the top ones) that gives you the value of the previous iteration. If it is the same than the one that you have in the current iteration nothing happens. Otherwise, it adds a new element to your array (empty when you start).

0 Kudos
Message 7 of 7
(4,214 Views)