LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Question About File Saving and Counting

I have two fairly simple questions for a spectral acquisition program I am writing. First of all, I have a boolean button inside a while loop that continually checks whether it has been pressed. If it has, the program takes one snapshot of data and saves it. I want to count and store the number of times this button has been pressed so that the first time it's pressed during program execution, the user will be given a prompt to create a new spreadsheet to save the data in. Every time afterward, the program will automatically append the data to that same spreadsheet. 
 
Similarly, in a different part of my program, I am running a continuous spectral map with several nested for loops and would like to save all the data into one spreadsheet. Right now, the program will separate the first snapshot of data from the rest, creating two spreadsheets because I cannot tell it to append the the latter data to the user-created spreadsheet (the user might create a C:/Data3.xls, but the program will always try to append to a C:/Data1.xls, for example).
0 Kudos
Message 1 of 3
(2,450 Views)

For the first, part, use a shift register in the while loop

initialize shift register to '0' outside the loop and inside the loop, keep incrementing the value, each time u press the button.

a numeric indicator connected to the shift register inside the while loop will display the count

I am sorry I could not exactly understand second part of your query.

0 Kudos
Message 2 of 3
(2,438 Views)
Hi Anqi,

for the first question: if it's only the decision 'create new file or not' you can use a shift register for the file path and initialize it with a 'Not a path' constant.

For the second: It seems an attachment could help... Show us your code and we will tell you where the bug is hiding 🙂

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 3
(2,436 Views)