I am converting an SDK vi provided by a data acquisition card company to suit my needs. The original vi records multiple data segments in the card memory and displays in a waveform graph on the front panel without any saving to file function. I can input "Number of Records" to set how many segments (waveforms) I want to acquire. Once the acquisition is over, I can click on "segment" (a "control" on the front panel to input a number) to view the nth segment. To save all the data segments into one file, I put the "Write Delimited Spreadsheet VI" in this VI, with attache to file and transpose function.
My problem is that once I add the save file function, the VI is only saving one segment if the "Run" is set at "False," and then by clicking the arrow to add one in the "Segment" control on the front panel, the next segment data will be saved in the same file and attach after the previously segment. Or the VI will keep saving data without stopping if the "Run" is set at "True. What I want is when I set the "Number of Records" as X (an integer), the file will save X segments. I tried to add a counter to automatically add one each time and replace the "Segment" input but was not working.
I feel that I am getting very close to what I want but after a week I decided to ask for help. Any comments and suggestions welcome. Thank you.
I also provide the VI here, but as the subVIs in the file is from the acquisition card company I am not sure if those are showing. I've also asked for permission to post the VI as I changed some parts in it, but I believe anything in that other than mine, the company has the copyright.
Start over. Seriously, this code is not very good at all. I would highly recommend that you look at using a state machine for this code. To start with, each frame of the stacked sequence can be an initial state within the state machine. From there you can clean it up further.