01-09-2013 12:56 PM
I know this is a simple question but I need some help. I'm reading a DC voltage in LabVIEW a while loop. I want to store all the read values into an array and export that array as an text or Excel file. I had a VI that I build before for this but I cannot seem to find it and I can't remember how I did it before. Any help is appreciated. I think I can do the exporting part but I do help with building the array (storing all the data values).
01-09-2013 01:51 PM
There is a function under the File I/O called "Array to spreadsheet file". Give that a try.

01-09-2013 03:22 PM - edited 01-09-2013 03:23 PM
I couldn't find "Array to spreadsheet file" but I did find "Array to spreadsheet string".. Is this what you were talking about?
I actually need more help building the array. I attached a screenshot of what I'm working on. I think I can use the "Write to Measurement File" express VI to write the file once I have the array.
01-09-2013 03:33 PM
I wouldn't recommend building an array of all of your data then doing a single file write. Since you are using a while loop, I assume you don't know how long the loop is running for so you (or LabVIEW) won't know how much memory to allocate. It lends poor performance because of continuous memory allocations and you could also run out of memory.
It is much better to stream your data to disk as you go (assuming you are running for longer periods of time). Check out some of the File IO Examples in the example finder.
Browse>>Fundamentals>>File Input and Output>>Write to Text File.vi
01-09-2013 03:42 PM
Thank you for the tips. In this case I am using a while loop but I will actually change my code in the future and use a for loop. I only have take about 100 measurements or so. I will look into the example VI.
01-09-2013
03:47 PM
- last edited on
01-21-2025
03:36 PM
by
Content Cleaner
If it is such a low number of measurements the auto-indexing on the loop will build an array for you and then you could use the Write To Spreadsheet File VI
01-09-2013 03:51 PM
I know this is a stupid question but I couldn't get the auto indexing to work with my while/for loop. Can you post an example, if you have one? That's what I been stuck on actually. I saw some examples online and those worked in terms of building the array but when I tried to re-create the VI my VI wouldn't create the array. I accidently deleted the VI's or else I would post them.
01-09-2013
03:55 PM
- last edited on
01-21-2025
03:36 PM
by
Content Cleaner
01-09-2013 04:02 PM
Thanks. I don't know why it didn't work before; I did have the auto indexing on. But I just created one of the example VI's I saw before it worked, :). And also it's working in my code. Thank you for the help.
01-11-2013 10:00 AM
I run into a problem while using the "Write to Text File Function". Initially I took about 60 measurements and wrote to a text file. That works but I increased the amount of measurements to be taken to 600 and when I did that the output in the text file are all Chinese letters (or that's what it seems like). Is this because I'm writing too much data?
When I use the "Write To Spreadsheet File VI" to write the measurments it works fine for the 600 measurements. The problem with this is I cannot insert any text. Using the "Write to Text File Function" I inserted some text before the measurements and "end of lines", to format the data. Attached is a screenshot of my VI.