八度dlmread无法读取日期格式 [英] Octave dlmread won't read date format
问题描述
我有一个csv文件,该文件来自
第一列包含我要使用此命令读取的日期:
matrix = dlmread('waves-measuring-buoys-data/WavesMooloolabaJan2017toJun2019.csv',',',1,0);
(如果在Kaggle上引用文件,请注意,为了便于阅读,我对目录和文件名进行了一些修改)
然后,当我通过打印矩阵(2,1)检查日期时,我得到的是1,而不是2017年1月1日00:00.
如何获取正确的格式?
csvread
仅用于数字输入.
请改用 io
包中的 csv2cell
,以字符串形式获取数据,然后相应地执行任何必要的字符串操作和转换.
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?
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.
这篇关于八度dlmread无法读取日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!