Jump to content

Writing to a Labview Measurement File


Recommended Posts

I have an instrument set up to my computer that measures the current, voltage, and power of a system. I am using the Instrument I/O assistant to acquire three (3) seperate data signals that I am then attempting to save all to a single file. So far I have not been able to do this. Does anyone have any ideas about how to save three seperate signals allong with the timestamp that the vi usses all to a file? If you do please let me know. I do remember reading about the channels in the help file, and how multiple channels can be saved, i just haven't found exactly how to do that. All ideas are welcome.

Link to comment

What I always used to do was to store my collected data in a 2D array (if there wasn't a LOT of it) and then use the "array to spreadsheet string" function to convert it to a string and then write it to a file. If it's tab delimited, you can call it a ".xls" file and Excel will open it, or call it txt, etc.

I've attached an example using a "Get Date/Time String" and 3 random number generators stored into a 1D array to kind of give you an example. I hope it helps. If you're collecting data faster than once per second, you might want to use the "Get date/time in seconds" function and format it to your liking. That function will give you a timestamp with millesecond precision.

post-2411-124769362039_thumb.jpg

Edit: I noticed you're running LabVIEW 7.0, so I included a vi for you. The difference between the vi and the image, I included an indicator for loop iterations, and removed the file path constant, so it will prompt you to save it somewhere.

Hope it helps!

Link to comment

Well, there is a write file command in the example I provided, but it's not one of the higher level ones like "Write Characters to File.vi". That function opens, writes to, and closes a file each time it's run. My example image illustrates opening a file, keeping it running while you want to write to it, and closing it when you're done. This method is faster and uses less redundant actions that will take up processor time.

You could use the "Write Characters to File.vi" if processing time and speed are not an issue. At what time iterations are you wanting to log data? I'm getting kind of lost as to what exactly you're wanting to do.

Link to comment
I have an instrument set up to my computer that measures the current, voltage, and power of a system.  I am using the Instrument I/O assistant to acquire three (3) seperate data signals that I am then attempting to save all to a single file. So far I have not been able to do this.

1123[/snapback]

What data-type are the signals? Waveform datatype, arrays or scalars?

I was wondering if there was a way of accomplishing this while still using the write to file commands.

1130[/snapback]

Which functions do you mean? The Write to Measurement File Express VI's, the write to spreadsheet VI's or the Write File function?

The example that Bryan gave you shows using the low level LV primitives (functions). Here are some other examples:

post-2-1089652079.gif?width=400

post-2-1089652528.gif?width=400

Link to comment

Sorry for the confusion Bryan. I am new to labview and I feel that by using the higher end commands I will be less prone to making a mistake. Either way, I very much appreciate the help. I ended up doing what Michael suggested and simply merged the signals. I tried doing that before but I ended up getting flow errors. This time I created the merging symbol myself and it worked. I am however having some trouble with the headings. I am not sure how to give them propper names. and I was also wonder if there was a way to create a column with a time stamp not of the relative time but the absolute time.

Link to comment

No problem on the confusion. I'm more familiar with the lower-level LabVIEW programming because when I first started using LabVIEW, there wasn't a whole lot of higher level things for me to play with, and the ones that were there lacked some desired functionality, so I ended up in "trial-by-fire" situations where I HAD to learn the lower level stuff.

Sorry I couldn't be much help. :)

Link to comment
  • 1 month later...
What I always used to do was to store my collected data in a 2D array (if there wasn't a LOT of it) and then use the "array to spreadsheet string" function to convert it to a string and then write it to a file. If it's tab delimited, you can call it a ".xls" file and Excel will open it, or call it txt, etc.

I've attached an example using a "Get Date/Time String" and 3 random number generators stored into a 1D array to kind of give you an example.  I hope it helps.  If you're collecting data faster than once per second, you might want to use the "Get date/time in seconds" function and format it to your liking.  That function will give you a timestamp with millesecond precision.

post-2411-124769362039_thumb.jpg

Edit: I noticed you're running LabVIEW 7.0, so I included a vi for you.  The difference between the vi and the image, I included an indicator for loop iterations, and removed the file path constant, so it will prompt you to save it somewhere.

Hope it helps!

1124[/snapback]

I have a question about this attachment.

What's this for a symbol with the constant "3"?

I don't know this symbol and can't find it :headbang:

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.