LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write 1d cluster continuously in csv

Solved!
Go to solution

I would like to know how can i write the 1d cluster in . csv?

0 Kudos
Message 1 of 18
(3,567 Views)

Hi josi,

 

what does the cluster contain?

Which data format/layout do you need in your CSV file?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 18
(3,563 Views)

 it contains 2 double and 1 array 

0 Kudos
Message 3 of 18
(3,555 Views)

Hi josi,

 

unbundle the cluster, prepend the scalar DBL values in front of the array.

Do this for each cluster and you will get a 2D array. Save that 2d array in your csv file…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 18
(3,546 Views)

I would use a FOR loop to create an array of strings, an element for each line that goes in your file.  Format Into String would be useful here.  Then use the Write Text File to actually write to the file.  Open/create your file before your loop and close it after the loop.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 18
(3,541 Views)

i' ve tried this but my vi write 2 datas only 

 

See the file 

 

Tks 🙂 

0 Kudos
Message 6 of 18
(3,533 Views)

You need to wire a True to the Append to File input of Write to Spreadsheet File.vi. As you have it configured, it overwrites the old data on every iteration of the while loop.

 

Turn on the context help window to get more information.

 

Lynn

0 Kudos
Message 7 of 18
(3,526 Views)
You haven't wired the y array to anything. There's also no real reason to convert everything to strings. You can write all as dbl.
0 Kudos
Message 8 of 18
(3,508 Views)

i did the conversion because i wanna add another sring with the names of the colums 

0 Kudos
Message 9 of 18
(3,495 Views)

Ok, stop using the Write To Spreadsheet File VIs.  Use the actual File IO API.  This way you can create the file, write the header data, write data continuously in the loop, and then close the file after the loop.  It will make things a lot simpler and a lot more efficient.

 

There is also no need to wire up the N on the FOR loop since you have an autoindexing tunnel that will tell the loop how many times to iterate.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 10 of 18
(3,486 Views)