I downloaded Coastal buoy data from the CDIP webpages and saved it as a text file. The trouble is that the data has spaces between the YYY MM DD hh mm.
{Edit 4/5/2019: Updated link Please see comment below}
With FileNames
and Import
, I was able to import the data from a text file.
fn = FileNames["*.txt"]; (*I am interested in the first text file in this list*)
h2018 = Import[fn[[1]], "Data"]
What I want to do is convert the first 5 columns to DateList
and then plot the 9th column against this new DateList.
I tried doing this to no effect because I am trying to convert the data to a string and then replacing spaces in the new string with /
and then using DateList
.
StringReplace[ToString[h2018[[3 ;;, 1 ;; 3]]], "," .. -> "/"];
StringReplace[%, " " -> ""];
dl=DateList[%];
How do I convert this string to a DateList and complete my plotting of column 9 in h2018
with the DateList, dl
?
I did try to convert this string to a list of numbers using the information in this question but without success.
Flatten@ToExpression@StringSplit[%];