0
Offline
Jr. Member
Karma: 0
Posts: 53
Arduino rocks
|
 |
« on: October 10, 2012, 05:04:51 am » |
Hi all. I made a temperature datalogging with SD card. For now, I just have logged number of logging and temperature. id.......Temperature 1.......22.31 2.......22.90 3.......23.47
Now I want it to import data to excel. But as I programmed, id and temperature goes into one colone. Is there a way to get them into 2 colones?
-Andy
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Online
Brattain Member
Karma: 143
Posts: 19380
I don't think you connected the grounds, Dave.
|
 |
« Reply #1 on: October 10, 2012, 05:19:45 am » |
Is there a way to get them into 2 colones? Yes there is, don't use println for every item. And post code.
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
New Jersey
Offline
Edison Member
Karma: 26
Posts: 2455
|
 |
« Reply #2 on: October 10, 2012, 06:44:44 am » |
Put a comma between them and import it into Excel as a csv file.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
|
 |
« Reply #3 on: October 10, 2012, 07:01:38 am » |
Like: Serial.print(id); Serial.print(','); Serial.println(temperature)
You obtain something like 1,25 2,54 3,44
Also, give the file the extension "csv".
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 53
Arduino rocks
|
 |
« Reply #4 on: October 10, 2012, 07:11:15 am » |
Hi. Thanks for your reply. Here is the code i have to store to memory:
File dataFile = SD.open("datalog.csv", FILE_WRITE); if(dataFile) { dataFile.print(id); dataFile.print(','); dataFile.println(sensor1); dataFile.close(); // print to the serial port too: Serial.print(id); Serial.print("\t"); Serial.print(sensor1); Serial.print("\t"); Serial.println(gjennomSnitt); //Increment ID number id++; }
When i imported the data, I got what I wanted. But is there a way to solve this without importing??
-Andy
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 336
Posts: 36476
Seattle, WA USA
|
 |
« Reply #5 on: October 10, 2012, 07:24:36 am » |
But is there a way to solve this without importing?? Yes, there is. Open a .xls file in notepad. See all the special characters? Figure out what they mean, and write the corresponding data to the file you create, with the .xls extension.
|
|
|
|
|
Logged
|
|
|
|
|
Gosport, UK
Offline
Faraday Member
Karma: 19
Posts: 3117
|
 |
« Reply #6 on: October 10, 2012, 07:30:39 am » |
But is there a way to solve this without importing?? Yes, there is. Open a .xls file in notepad. See all the special characters? Figure out what they mean, and write the corresponding data to the file you create, with the .xls extension. I started to do that once, and gave up. This document may help if you want to take that route - http://www.openoffice.org/sc/excelfileformat.pdf.
|
|
|
|
|
Logged
|
|
|
|
|
New Jersey
Offline
Edison Member
Karma: 26
Posts: 2455
|
 |
« Reply #7 on: October 10, 2012, 10:38:10 am » |
As long as it has a csv extension, Excel will open it without a need to import
|
|
|
|
|
Logged
|
|
|
|
|
Gosport, UK
Offline
Faraday Member
Karma: 19
Posts: 3117
|
 |
« Reply #8 on: October 10, 2012, 10:43:21 am » |
I know what the OP means though. If you double-click on a csv file, sometimes Excel will put each line in to a single cell.
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 336
Posts: 36476
Seattle, WA USA
|
 |
« Reply #9 on: October 10, 2012, 10:57:15 am » |
If you double-click on a csv file, sometimes Excel will put each line in to a single cell. That depends on how you've told excel to handle csv files. I don't think that excel defaults, properly, to expecting a comma between the comma separated values in the csv file. For some reason, it expects, IIRC, that the c stands for semicolon.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
God Member
Karma: 15
Posts: 967
|
 |
« Reply #10 on: October 10, 2012, 11:09:10 am » |
I've used the Arduino to generate CSV files on a uSD card. Double-left-clicking on the filename immediately opens the file in Excel with each Comma Separated Value entered in a new field. As far as I can remember, I haven't done any special setup in Excel to make it do that. This is with Excel 2010 on WIn7Pro.
Pete
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
|
 |
« Reply #11 on: October 10, 2012, 11:50:42 am » |
But is there a way to solve this without importing?? What do you mean ?
|
|
|
|
|
Logged
|
|
|
|
|
Saskatchewan
Offline
Full Member
Karma: 10
Posts: 230
When the going gets weird, the weird turn pro. - Hunter S. Thompson
|
 |
« Reply #12 on: October 10, 2012, 12:13:45 pm » |
If all you want to do is make graphs consider trying gnuplot ( www.gnuplot.info). It wants data in a plain text file in columns. It's very fast. A week's worth of data from my log file has around 35,000 data points and the graph snaps onto my screen even on my old Toshiba laptop. It has zooming and auto ranging. It isn't the most straight forward thing but if you can program Arduino it shouldn't be too hard. It even does Windows now.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 53
Arduino rocks
|
 |
« Reply #13 on: October 10, 2012, 03:26:52 pm » |
Hi guys  I mean when i take the SD card out from Arduino, deploy it to my computer, and then open it in Excel. It´s saved as datalog.csv. I tried cupple of things. Serial.print(","); Serial.print(´,´); String(id +" , "+ temp);. Still same prob. When I open datalog.csv, I get the value like: 1, 22.5 2, 22.9 3, 22.1 4, 22.3... But when I imported csv file, I got the data in 2 different columbs. It´s really not a big issue, but it would be nice to get everything workout as I want to  But again guys, thanks for your help so far  -Andy
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
|
 |
« Reply #14 on: October 10, 2012, 03:34:51 pm » |
Don't put a blank after the comma.
On the Arduino side, Serial.print(id); Serial.print(","); Serial.println(value) is ok.
You can try "\t" in place of ","
|
|
|
|
|
Logged
|
|
|
|
|
|