LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Arrays to Spreadsheet

Solved!
Go to solution

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,

 

0 Kudos
Message 1 of 21
(5,283 Views)

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.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 2 of 21
(5,276 Views)

I'm writing it to a .txt file using Write To Spreadsheet File VI.

0 Kudos
Message 3 of 21
(5,261 Views)

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.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 4 of 21
(5,256 Views)

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)?

0 Kudos
Message 5 of 21
(5,250 Views)

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.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 6 of 21
(5,236 Views)

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.

0 Kudos
Message 7 of 21
(5,232 Views)

Would you like me to upload the vi?

0 Kudos
Message 8 of 21
(5,227 Views)

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.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 9 of 21
(5,226 Views)

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.

0 Kudos
Message 10 of 21
(5,210 Views)