LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Case Structure timing/ writing data to a excel


@lneill65 wrote:

Do you think this will work or should I seperate the loops rather than using the nested loop inside the main?


No, because the inner loop will block the outer loop from iterating until the inner loop is complete.

0 Kudos
Message 11 of 14
(778 Views)

My guess is it is probably not going to work the way you want, but now you've added more code making it so I don't know what you want.

 

You do know that the other code in the outer while loop will execute once while the inner while loop keeps running until you hit the "Stop Recording" button.  At that point of time, the outer while loop will begin its next iteration, the other code executing one time while the inner while loop begins again and keeps iterating.

 

If this is not what you meant to have happen, then you really should take some tutorials before posting another attempt at your VI.

0 Kudos
Message 12 of 14
(775 Views)

Ah ok, I basically want to be able to switch the writing of the data to excel on or off by using the boolean control. And write this data at each time increment without affecting the main loop.

 

I will have another look through some tutorials but thank you for the help so far.

0 Kudos
Message 13 of 14
(764 Views)

@lneill65 wrote:

Ah ok, I basically want to be able to switch the writing of the data to excel on or off by using the boolean control. And write this data at each time increment without affecting the main loop.


A simple case structure instead of the inner while loop would work, since your speeds are quite slow. Otherwise, use a produce/consumer arcitecture and use a queue to write to the file asynchronously.

 

One limiting current factor is the way you are writing to the file. "Write to spreadsheet file" is a highlevel function and opens and closes the file with every call (you can look at the inside diagram to see what it is doing). This is a lot of work! If performance is an issue, you should open the file once before the loop, then do plain writes inside the loop (i.e. your formatted number+a linefeed) and only close the file when the program completes.  Since the OS does a good job with disk caching, this will be much higher performances and won't hold up your loop. If you need even higher performance, use binary files, writing the raw DBL (or even SGL).

Message 14 of 14
(757 Views)