Jump to content

Output to spreadsheet


Recommended Posts

Hello,

I have a 10 input threshold detector in a while loop and I the data are collected outside the loop and saved when the "stop" button is pushed

If this program mis interrupted by something else besides the "stop" button (ie power cut) then I will not save any data.

How can I save the data while the program is running and also have some output IF the process is interrupted?

I tried saving the data in the loop but it creates many files. I have placed a time tag on the file path so that each time the program starts it writes the data/time on the file name. Inside the loop when it saves the data, it tries to save it to the same file but the time and hence file name have changed, so it creates multiple files. How can I solve this?

Thank you in advance,

Link to comment

I tried saving the data in the loop but it creates many files. I have placed a time tag on the file path so that each time the program starts it writes the data/time on the file name. Inside the loop when it saves the data, it tries to save it to the same file but the time and hence file name have changed, so it creates multiple files. How can I solve this?

It is quite simple to save the data in each loop to only one file, by doing something like this -

Firstly as you are talking about spreadsheets I would format any data to be saved in a CSV format so this can easily be open in Excel or as a text file later.

Open a file before you loop starts, this could be either a new files or an existing one. Pass the reference to this file into you loop and each time round your loop append you data into the file, when your loop finishes close the file.

Look in the LabVIEW Example Finder, there is a example VI "Write to Text File.vi" in the Fundamentals --> File Input & Output category that shows how to write to the same file in a loop

Danny

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.