Hi Mark,
The code you posted will be somewhat inefficient because you are starting and stopping the task inside the while loop. It is better to start and stop outside the loop and perform the acquisition inside.
However, I would consider taking a step back and approaching this from a different angle. If you don't have a need to write to a file "on the fly" (i.e. as you are acquiring data), then you need not worry about the elapsed time VI or the case structure. Instead, continually build an array of data as your loop iterates and then pass the final array to the file after you exit the loop.
To build the array, you can either:
1. Pass the output from the DAQmx read to the exit of the loop and enable indexing, or
2. Use a combination of a shift register and a build array function.
For both of these, you'll likely want to change the polymorphic instance of the DAQmx read VI to Analog » Single Channel » Single Sample » DBL. Also, add a wait function to your while loop and specify 1000 ms so that the loop will iterate every one second.
Eric C.
Applications Engineer
National Instruments