LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Case structure file write from while loop?

Solved!
Go to solution
Solution
Accepted by topic author CodeMunkee

Here is soemthing I think would work for you.

 

I was thinking of some sort of state machine architecture.  But instead I tried to be a bit slick with it and use some booleans to convert to 4 potential states based on whether the Save data button is pressed or not, and whether it was pressed in the previous iteration or not.

Message 11 of 14
(881 Views)

That *was* slick.  Perhaps you are the Ray Lewis of LabView.  It works perfectly with one exception - Case 2 returns an error if you have already toggled the Record Data Boolean to false, because the files have already been closed.  I guess I can try to rig something clever myself.

 

I've only got one more medium sized task before I complete this interface and send it packing into the field - maybe you hear from me, maybe you don't - either way, I am very grateful to you and the rest of the LabView community for all the help during this process!

 

 

0 Kudos
Message 12 of 14
(860 Views)
Solved!  (who needs a Case 4?)
0 Kudos
Message 13 of 14
(856 Views)

CodeMunkee wrote:

That *was* slick.  Perhaps you are the Ray Lewis of LabView. 

 Smiley Very Happy

 

It works perfectly with one exception - Case 2 returns an error if you have already toggled the Record Data Boolean to false, because the files have already been closed.  I guess I can try to rig something clever myself.

You're right.  I didn't try everything out.  My philosophy was that if you hit Stop while you are logging, you want to be sure that the file is closed before the program ends.  On the other hand, if you already undid the logging, then the file is already closed and the file reference becomes invalid.  Thus closing it again causes the error.

 

There are a few choices to solve this.  Once is wire up the error handler to a clear error function as it comes out of the close dialog.  Thus ignoring all errors.  Another is to clear only that specific error.  Another is to check whether the file reference is valid and only close it then.

 

 

I've only got one more medium sized task before I complete this interface and send it packing into the field - maybe you hear from me, maybe you don't - either way, I am very grateful to you and the rest of the LabView community for all the help during this process!

 

 


 

0 Kudos
Message 14 of 14
(851 Views)