LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write data from 12 element cluster to excel

Hi all

 

I'm trying to write the data I read from an arduino onto an excel file.

 

Currently I'm reading 12 signals, and I'd like to add a timestamp to the data.

My current blockdiagram looks like this:

data plotting 2.jpg

 

It creates a file but when I try to open this file something goes wrong: "file format or extension is wrong" something like that.

I also tried 1D array, but got the same, 2D also seems more logical to me.

 

I also like the output file to look something like this:

data plotting.jpg

 

 

Could anyone help me get started, what am I doing wrong?

Should I use another block?

 

0 Kudos
Message 1 of 25
(4,519 Views)

Hi XebeXUC,

 

what am I doing wrong?

Well, you don't show the filename you are using in your VI - I guess it's related to your error message "file format or extension is wrong"!

 

Should I use another block?

WriteToSpreadsheetFile is fine.

All you need to do is using the correct filename: something with an extension of "csv" is fine…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 25
(4,514 Views)

What is the name of the file you are writing to?

 

Where is the first row of data betting written?

 

You do know that the Write to Spreadsheet File does not create native Excel .xls or .xlsx files, but creates delimited text file.  Don't you?

0 Kudos
Message 3 of 25
(4,507 Views)

I'm using .xlsx or does that not work for this block?

0 Kudos
Message 4 of 25
(4,506 Views)

Hi XebeXUC,

 

does that not work for this block?

No, it does not! (Well, infact its not at all important for the WriteToSpreadsheetFile function - but its Excel who complains about the wrong filename!)

 

Did you read the help for this function? Use "csv" as suffix!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 25
(4,502 Views)

I messed up because I was also reading about the other blocks.

 

Then all I have to do now is convert it to excel

(which apperently works in excel)

 

and get the data seperated instead of in one line

 

which is also almost working, currently it looks like this:

data plotting 3.jpg

 

idk what happened to line A and N

 

 

edit:

alright fixed, A is just the time in a big number and N seems to be a repetition of the data

0 Kudos
Message 6 of 25
(4,493 Views)

Hi XebeXUC,

 

Then all I have to do now is convert it to excel (which apperently works in excel)

Well, Excel can easily read CSV files. No need for any conversion…

 

and get the data seperated instead of in one line

As CSV files are just plain text files you could add as many line breaks you like. But WriteToSpreadsheetFile already does it for you I don't know why you get your data in "one line" right now…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 25
(4,487 Views)

The internet provided a solution

in the 'data' tab in excel i had to choose from 'read from txt'.

 

Well thanks for you quick help once again.

 

Could you perhaps help me with adding the right timestamp?

I'm not sure what to use for that

 

Edit: perhaps can you also tell me how to put a delay so that I only store data every minute or so?

0 Kudos
Message 8 of 25
(4,482 Views)

Hi XebeXUC,

 

in the 'data' tab in excel i had to choose from 'read from txt'.

All you need to do is using a file suffix of CSV (and use the correct delimiter in your CSV file)!

 

Could you perhaps help me with adding the right timestamp?

Use GetDateTimeInSeconds and a FormatIntoString function (or FormatDateTimeString) with a format string suitable for you!

 

Edit: perhaps can you also tell me how to put a delay so that I only store data every minute or so?

Well, there is a palette full of timing functions!

Hint: instead of waiting for a minute you should wait just 500ms and only save your data every 120th iteration…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 25
(4,463 Views)

data plotting 4.jpg

I thought this might work, but I can't let the 'false' state on the select open :s

 

Am I even near the solution?

0 Kudos
Message 10 of 25
(4,454 Views)