Octave dlmread won't read date format

白昼怎懂夜的黑 提交于 2021-01-28 20:10:03

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!