LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I add sample data to an array based on a boolean value.

In my while loop the value of a GPCTR must be saved into an array only when a certain DIO line is high. Otherwise the value of the GPCTR should be ignored. Subsequent iterations should add the counter value to the array so that when exiting the while loop the array contains only the values of the GPCTR when the DIO line was high.
0 Kudos
Message 1 of 8
(3,365 Views)
Try this: (attached)

Just use a shift register wired to the output of a build array in a case with the case wired to the DIO. In the True case, update the array with the counter value. In the false case, pass the shift register through.
Message 2 of 8
(3,365 Views)
Although your answer seems to be exactly what I need, I can't open your attached file. I have version 5.1 of LabView. The error is "Resource not found. An error occured loading VI "UpdateArrayOnDIO". LabView load error code 8: Could not load VI resource."
0 Kudos
Message 4 of 8
(3,365 Views)
I have seen your problem, now saved in LabVIEW5.0
please find it attached
regards
wha
0 Kudos
Message 6 of 8
(3,365 Views)
Thanks for the information. It works great!!
0 Kudos
Message 7 of 8
(3,365 Views)
GR -

Hello, and thanks for using Developer Zone!

The key to getting the output that you are looking for is going to be a case structure. If you place a case structure inside of your while loop, it will respond to the changing value of your DIO line, which you should wire to the input of the structure. Whichever case you equilibrate with the high state of your DIO line, you can place the necessary VIs within it in order to get the proper saving format for your array. You can leave the remainder of your cases blank since you wish to ignore the value of the GPCTR line unless the DIO line is high.

I hope that this has helped with your program. If you have any other questions, please feel free to utilize Developer Zone again. Thanks again for your question.


Best regards,
Greg Wempe
0 Kudos
Message 3 of 8
(3,365 Views)
If I place the array inside my case statement and try to wire the array through the case statement to save the array to a file, LabView tells me I have to supply an output for each case. Could you post a sample VI to show me exactly how to do this?
0 Kudos
Message 5 of 8
(3,365 Views)
I had it configured exactly as LabVIEWGuru has shown you already. I apologize for not getting the sample VI to you with my response. I'm glad that you've gotten your problem solved.

Thanks again for using Developer Zone.

Best Regards,
Greg
0 Kudos
Message 8 of 8
(3,365 Views)