LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving punctual values using write delimited spreadsheet

My problem is quite simple, and my solution should be working according to the documentation. I have a program that runs indefinitely within a loop. Using the iteration counter and the Reminder and Quotient function, I can set a delay on my save so that I don't save data at every loop iteration. To do so, I check whether the remainder is =0 to either save or bypass the save for the current iteration. The problem is that, even though I use a shift register to keep track of the file path and ensured that ''Append to file?'' was set to true, the save stops after the second save iteration. No pop-up windows asking for a new file path or any error occurs: the data just stops saving. Is there any additional steps that are required to re-open a file once the write delimited file function has been skipped once? The image below shows an example of my program loop.

 

ExampleSaveSequence.PNG

0 Kudos
Message 1 of 7
(148 Views)
  • Your blue inputs are swapped. the iteration terminal should go on top and 5 at the bottom.
  • It is pointless to place the path into a shift register because it is loop invariant.
  • You can wire the remainder directly to the case structure and make one case 0 and one the default.
  • Currently, you get a save on the first iteration. If you want to change it so the first save is after five iterations, add a "+1" after the iteration terminal.
  • You should define a loop rate. currently is spins as fast as the computer allows.
  • How do you get new 1D data?
  • It would be more efficient to use lowlevel file IO, open the file before the loop, close after the loop, and append a row whenever needed inside the loop. The highlevel file write you are using is opening and closing the file with each call, which is much more overhead.
  • etc.
0 Kudos
Message 2 of 7
(125 Views)

see if this can give you some ideas:

 

altenbach_0-1752264896350.png

 

0 Kudos
Message 3 of 7
(110 Views)

@altenbach wrote:
  • It is pointless to place the path into a shift register because it is loop invariant.

Not true if he's passing in a blank path some or all of the time to use the "Dialog if empty" feature of the Write Delimited File command on the first iteration and pass it to all others after that.

Message 4 of 7
(108 Views)

@Kyle97330 wrote:

@altenbach wrote:
  • It is pointless to place the path into a shift register because it is loop invariant.

Not true if he's passing in a blank path some or all of the time to use the "Dialog if empty" feature of the Write Delimited File command on the first iteration and pass it to all others after that.


Yes, in that edge case. Since the terminal was placed outside, I assumed that they pick a valid path before running, else the first iteration would take much longer than 5 seconds (Assuming a 1s loop rate from the diagram comment), thus invalidating all time points. 😄

0 Kudos
Message 5 of 7
(104 Views)

@LTSB_Student wrote:

The problem is that, even though I use a shift register to keep track of the file path and ensured that ''Append to file?'' was set to true, the save stops after the second save iteration.


Where, precisely do you do that?  [Hint -- you might use a second Shift Register ...]

 

Bob Schor


0 Kudos
Message 6 of 7
(42 Views)

@Bob_Schor wrote:

@LTSB_Student wrote:

The problem is that, even though I use a shift register to keep track of the file path and ensured that ''Append to file?'' was set to true, the save stops after the second save iteration.


Where, precisely do you do that?  [Hint -- you might use a second Shift Register ...]



As I said, the problem is that the inputs to the Q&R are reversed, so the remainder is only zero exactly twice.

 

altenbach_1-1752335326963.png

 

 

Once the inputs are swapped, you get regularity. 😄

0 Kudos
Message 7 of 7
(33 Views)