From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

store data in array just when there is data.

Solved!
Go to solution

Hello everyone

i have a program in follow that i want save data in array just when the Boolean is on. i don't want array recording data when the Boolean is off.

can any one help me please?

i use labview 2018

0 Kudos
Message 1 of 15
(2,588 Views)

Rather than using "Insert into Array", you should be using Build Array.  Build Array is easier to use if you know you are always putting the element at the beginning of the array like you are doing now (is that what you really want?), or at the end of the array.

 

When you want to selectively do something, you put that code in a case structure!

 

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

0 Kudos
Message 2 of 15
(2,577 Views)

Thanks for answer

what i  want is like this:

just when i press boolean button, store a record in array. but it is not working like that and  even when i dont press botton, array continue recording.

please see the picture.

 

0 Kudos
Message 3 of 15
(2,560 Views)
Solution
Accepted by topic author amkamyab

@amkamyab wrote:

please see the picture.


Your problem is in the diagram, not the front panel, so why would you show a picture of the front panel??? We cannot troubleshoot that. We need to find the cause, not the effect!

 

Here's one simple possibility:

 

AppendSome.png

0 Kudos
Message 4 of 15
(2,552 Views)

... and if you don't need the array during the loop, built it at a conditional output tunnel.

 

AppendSome2.png

 

Of course it seems completely pointless to create a potentially large array where all elements are the same. How redundant! That array can be described by a single integer! Maybe you could just keep count and create that array at the end in one swoop!

 

AppendSome3.png

 

 

0 Kudos
Message 5 of 15
(2,547 Views)

thank you @

can you show me what must be in false case?

0 Kudos
Message 6 of 15
(2,541 Views)

@amkamyab wrote:

can you show me what must be in false case?


 

Can you take a wild guess???

 

(In the false case, nothing should happen to the array, so it would be just wired across unchanged, right? You really need to start with some basic tutorials before continuing!))

0 Kudos
Message 7 of 15
(2,540 Views)

may i ask you run my program  and make delay 1000 millisecond and then some times push the button and see result in array?

0 Kudos
Message 8 of 15
(2,534 Views)

this helped me. thanks

may i ask you another question.

i want to record time of each data in array that i can see delay between pushing buttons.

0 Kudos
Message 9 of 15
(2,531 Views)

@amkamyab wrote:

may i ask you another question.

i want to record time of each data in array that i can see delay between pushing buttons.


Well, this thread is already marked as solved, so maybe you should start a new thread with a new question.

 

There is only one button, so why do you say "buttons"? (Do you also want to record the stop button?)

 

Your question is not clear at all. Do you want the "On-times", the "OFF-times", the time between OFF-ON (or ON-OFF) transitions, or the times between value changes of the boolean, ... or something else? What mechanical action do you want (switch, latch, switch until released, etc.)? How should the times be stored? What time resolution do you need?

0 Kudos
Message 10 of 15
(2,519 Views)