09-15-2010 02:18 PM
Hi,
I've a vi that process data files and saves the analysis on a new file (it's a 2D array). This being done in a for loop to allow multiple files to be processed with user intervention. Instead of saving a new analysis file every iteration, I would like to save all of the analyzed data in one file. For example:
Cable #11
x y z
1 2 3
4 5 6
Cable #12
4 5 4
3 2 2
.
.
.
.
The two problems I have:
I know how to insert headers but how do you insert a string after each array?
How do I save all the arrays to one array? I've tried taking the spreadsheet function out of the for loop, but it didn't work.
I'll appreciate any input,
Solved! Go to Solution.
09-15-2010 02:26 PM
Depends on what you mean by "spreadsheet". An Excel file contains sheets, each of which is a 2D array so it could hold 'pages' of 2D arrays. A regular text or CSV type of spreadsheet is only 2D so you would have to stick with multiple files or write your own code to index each 2D array in some way.
09-15-2010 02:40 PM
I'm writing it to a .txt file using Write To Spreadsheet File VI.
09-15-2010 02:48 PM
Then you'll have to simulate the pages in some way. For instance you could add a page number string in your header for each set of 2D data. The program (or person) who reads the resulting text file would have to know how to separate the data based on that.
09-15-2010 02:52 PM - edited 09-15-2010 02:56 PM
I'm not sure I know what you mean by "simulate the pages in some way," the "cable #" in my example is a string that I take from the original data file name to know which data files were processed .
Is it possible to have an analyzed data file created every iteration and then when the loop is done to combine all the files (or have a cluster of arrays of some sort and then save to one .txt file)?
09-15-2010 02:57 PM
If you just want the one file to continue to grow and you already have the title for each test embedded in the data then why not just set your spreadsheet to file VI to append? It's built-in to it.
09-15-2010 03:02 PM
I've tried it while it was in the for loop, the problem was that it created multiple files w/the data at random places.
09-15-2010 03:06 PM
Would you like me to upload the vi?
09-15-2010 03:06 PM
If it's set to append it should NOT create multiple files. It should just add more data to the end. You'll have to post your VI.
09-15-2010 03:23 PM
I've tried appending it in & out of the for loop and it doesn't make a difference; it just writes the last data file.
Thank you for taking a look at it. The data I want to save is the case structure outside of the for loop.