问题
I have a csv file, the one from https://www.kaggle.com/jolasa/waves-measuring-buoys-data-mooloolaba/downloads/waves-measuring-buoys-data-mooloolaba.zip/1. The first entries look like this:
The first column has dates which I'm trying to read with this command:
matrix = dlmread ('waves-measuring-buoys-data/WavesMooloolabaJan2017toJun2019.csv',',',1,0);
(If referring to file on Kaggle, note that I slightly modified the directory and file names for ease of reading)
Then when I check a date by printing matrix(2,1), I get 1 instead of 01/01/2017 00:00.
How do I get the correct format?
回答1:
csvread
is only for numeric inputs.
Use csv2cell
from the io
package instead, to obtain your data as a string, and then perform any necessary string operatios and conversions accordingly.
来源:https://stackoverflow.com/questions/58205873/octave-dlmread-wont-read-date-format