|
From: | Markus Bergholz |
Subject: | Re: CSV Import |
Date: | Mon, 28 Jan 2013 09:34:20 +0100 |
I realize this is an old thread that I'm resurrecting, but it is very similar
to what I am wanting to do. I need to load or import a text file with a
date/time stamp in the first column, header info is in the first row.
The partial contents of the file.csv are:
"Date","Time","Open","High","Low","Close","Total Ticks"
1/26/2012 5:00,1.06293,1.06688,1.05914,1.06507,96345
Using dlmread("file.csv",",")
0 0 0 0 0 0 0
1 1.06293 1.06688 1.05914 1.06507 96345 0
I'm not sure what I need to do in order to retain the date/time stamp. How
can the first column be imported as a character string while the remaining
columns are numeric.
Rich
fid = fopen("file.csv",'r');
r_rows = sprintf('%s %s', '%s' ,repmat('%f ',1,rows(yournumericalvalues))); data = "" r_rows, 'Delimiter', ',',
'HeaderLines', 12
);
fclose(fid);
function [d] = yourdateaction(x) d =
datenum(x,'DD/MM/YYYY') ;
yourfinalvalue(:,1) = cellfun(@yourdateaction, data{1});
yourfinelvalue(:,2:(
rows(yournumericalvalues)+1
)) = yournumericalvalues;
--
View this message in context: http://octave.1599824.n4.nabble.com/CSV-Import-tp2300503p4649173.html
Sent from the Octave - General mailing list archive at Nabble.com.
_______________________________________________
Help-octave mailing list
address@hidden
https://mailman.cae.wisc.edu/listinfo/help-octave
[Prev in Thread] | Current Thread | [Next in Thread] |