【发布时间】:2013-06-27 02:31:42
【问题描述】:
数据:
假设以下数据格式(第一行有标题行,500+行):
数字,数字,数字,字符串,字符串,数字,数字,数字,字符串,数字,数字,数字
示例:
1,0,3,"Braund, Mr. Owen Harris",male,22,1,0,A/5 21171,7.25,C85,S
我的密码:
忽略第 4、9、11 和 12 列(索引从 1 开始)。
[A, B, C, D, E, F, G, H] = textread("train.csv","%d %d %d %*q %s %d %d %d %*s %*s %f %*s %*s","delimiter",",","endofline","\n","headerlines","1");
错误:
error: invalid conversion from string to real scalar
error: fskipl: invalid number of lines specified
error: called from:
error: /usr/share/octave/3.6.4/m/io/textread.m at line 71, column 5
我是 octave 的新手,无法理解错误的原因。请指导。
【问题讨论】:
-
...,"headerlines","1")应该是...,"headerlines",1) -
没错。虽然格式有点乱。使用 %q 会报错:
strread: A(I): index out of bounds; value 1 out of bound 0
标签: matlab csv machine-learning octave