LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write entire array to text file after completing data collection

Solved!
Go to solution

Dell Netbook, WindowsXP home, NI-6008, Labview 8.5.1

 

I'm reading in 8 analog signals at 100Hz in a psydo-real-time app.  I cannot write directly to a data file during data collection (processor/flash drive to slow), but can store the data into 4 seperate 2D arrays, with a timestamp added.  Once I am done collection data I would like to save each array in to a seperate text (csv) file.  Using a for-loop takes to long and using the "array to spreadsheet string" adds labels that I can't seem to change.  I'm trying to get a stripped down text file of 3 columns and rows that equal the number of samples I collected (e.g., a 1 minute session would have 3 columns and 6000 rows).    

 

1,1.3,1.5,

2,1.2,1.4,

3,1.4,1.1,

4,1.5,1.2,

5,1.4,1.4,

etc

 

 

Thanks,

Troy

0 Kudos
Message 1 of 14
(4,527 Views)
Try to share some code with us over here. You are more likely to get a faster response if you can show what you have done.
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
Message 2 of 14
(4,505 Views)

Not exactly sure what labels you are talking about but for me the Write to Spreadsheet File Vi behaves exactly like what you say you want.

If i wire a 2-d array to it it writes the contents of the array to a file without adding anything aside from the dilimiters.

Message Edited by ravis on 05-12-2010 10:09 PM
0 Kudos
Message 3 of 14
(4,503 Views)

Yes, "Write to Spreadsheet file" does give me exactly the format I want, but I have only been able to use that vi in a for loop.  The "Array to Spreadsheet" vi lets me write the entire array without the for loop.  Is there a way to use the "Write to Spreadsheet File" vi to dump the entire array into the file?  

 

Thanks,

Troy

0 Kudos
Message 4 of 14
(4,495 Views)

I will try, I don't have a lot of experience clipping out bits of code.

 

Thanks,

Troy

0 Kudos
Message 5 of 14
(4,492 Views)

If you wire a 2D array into the Write to Spreadsheet File, you will get all data written to the file without using a For Loop.  If you are not able to do this, post your code.  You should be creating a 2D array from your data (no commas).  Wire this into the 2D array input of the Write to Spreadsheet File.

 

- tbob

Inventor of the WORM Global
Message 6 of 14
(4,489 Views)

tzarcone wrote:

Is there a way to use the "Write to Spreadsheet File" vi to dump the entire array into the file?  

 


Just wire the array to the "2d Data" input and it should write the whole array at once.

0 Kudos
Message 7 of 14
(4,488 Views)
array to file vi.jpg
0 Kudos
Message 8 of 14
(4,481 Views)

Well I think I over did the code picture.  It didn't look that big when I loaded it.  Anyway, you will see from my code the 1. I'm a novice and 2. that I'm trying to seperate data collection from saving the data using a frame squence.  The limitation is the CPU and flash drive, when I try to collect and save, my timing gets all screwed up.  

 

I did try to run the 2D array straight into a file, but I probably coded it wrong. 

 

Thanks,

Troy

 

 

0 Kudos
Message 9 of 14
(4,479 Views)

OK, here is another picture with one file (filename csv 1) being saved as "Array to spreadsheet" and another file (filename csv 2) using the "write to spreadsheet" vi. The second file only gives me the last sample (e.g., 6000,1.234,1.450).  

 

Cheers,

Troy

 

array to file vi.jpg

0 Kudos
Message 10 of 14
(4,449 Views)