LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write 2D data into Excel only once

Hi,

 

I have two 1D arrays of data that I want to save to an excel file (csv format). I have tried using the write to spreadsheet function which is not able to solve my purpose. It is writing the same N data points over and over (appended to the same file), so instead of having N lines, I have 100N or something lines.

 

I have attached my VI alongside. Any help appreciated.

 

Thanks!

Sanjay.

0 Kudos
Message 1 of 3
(2,502 Views)

Sanjay, I'm struggling to understand what you are hoping to accomplish, I see you have a 2 dimensional array and I see that you are grabbing the second column (array indices are zero based) and writing it to a file. I can't tell if you want to write the data as a 1D or 2D array to the file so I'll attempt to cover both

Writing the 2D array:

Wire "Array_val_3 3" directly to the "2D Data" input of the "Write to Spreadsheet File" VI.

 

Writing as a 1D array:

  1. Get the array size (returns array containing number of rows in element 0 and number of columns in element 1)
  2. Multiply the array elements to get total number of elements
  3. Use the reshape array function to coerce your 2D array into a 1D array containing all data
  4. Use the output of multiply array elements to determine the size for the reshape array function

VI Snippet is attached

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
0 Kudos
Message 2 of 3
(2,482 Views)

Thanks a lot for the help. Actually, I made the mistake of using run continuously instead of the run button. I'm new to labview and I'm sorry.

 

Thanks!

Sanjay.

0 Kudos
Message 3 of 3
(2,456 Views)