I'm trying to read in time series data with Date/Time in the first column, and numerical values in several columns to the right. It happens to be in CSV format, but I could easily put in tab format etc. I've tried (read_csv, mfscanf, msscanf, and evstr), but have not been successful. Any guidance would be appreciated.
1/1/2009 9:01,234.6,234.5,324.43,234.3,2342 1/1/2009 9:02,235.6,235.5,325.43,235.3,2343 1/1/2009 9:03,236.6,236.5,326.43,236.3,2344 1/1/2009 9:04,237.6,237.5,327.43,237.3,2345 1/1/2009 9:05,238.6,238.5,328.43,238.3,2346
Thanks, Mike
Thanks Allan,
"a(1)" that's all it took for me to realize I could pull the date/time column out independently.In case you're interested, here is how I am extracting the Date/Time info, and the numeric data, and then putting them all into a matirx. A little clunky, but functional.
-Mike
sRaw = read_csv(FileLoc+FileNam) //read time series data into a string matrixdTSData=zeros(sRaw) //preallocatefor i=1:size(sRaw,1) // loop through each row, extract Date/Time data, convert it to serial timestamps and put it in the first column of Data Matrix d = eval(strsplit(a(i,1),['/','/',' ',':']))' //Date/Time is currently in m/d/yyyy h:mm format dTSData(i)=datenum(d(3),d(1),d(2),d(4),d(5),0) //put into (y m d h m s) orderenddTSData(:,2:$)=evstr(sRaw(:,2:$)) //put all remaining columns next to serial timestamps in Data Matrix
Remember Me
Forgot your password?
Register Now!
5/15/2013Code Generation & Compilation - WildCruncher
5/15/2013Equalis Embedded Coder Module Part 2 – Sensored Brushless DC Motor Control
4/9/2013Equalis Embedded Coder Module Part 1 – Kalman Filter