05-08-2017 07:50 AM
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:
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:
Could anyone help me get started, what am I doing wrong?
Should I use another block?
05-08-2017 07:54 AM
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…
05-08-2017 07:56 AM
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?
05-08-2017 07:56 AM
I'm using .xlsx or does that not work for this block?
05-08-2017 07:57 AM - edited 05-08-2017 08:00 AM
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!
05-08-2017 08:00 AM - edited 05-08-2017 08:11 AM
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:
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
05-08-2017 08:06 AM
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…
05-08-2017 08:12 AM - edited 05-08-2017 08:16 AM
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?
05-08-2017 08:28 AM - edited 05-08-2017 08:29 AM
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…
05-08-2017 08:56 AM
I thought this might work, but I can't let the 'false' state on the select open :s
Am I even near the solution?