help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Loading CSV file into Octave


From: Markus Bergholz
Subject: Re: Loading CSV file into Octave
Date: Sat, 29 Jun 2013 14:08:38 +0200




On Sat, Jun 29, 2013 at 1:57 PM, guerrero <address@hidden> wrote:
*DATA:
*
Assume the following data format (with a header line in the first row, 500+
rows):

Number, Number, Number, String, String, Number, Number, Number, String,
Number, Number, Number

Example:
1,0,3,"Braund, Mr. Owen Harris",male,22,1,0,A/5 21171,7.25,C85,S


*MY CODE:
*
Ignoring the columns 4, 9, 11 and 12(index starting from 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");


*THE ERROR:
*
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


I am new to octave and unable to understand the cause of the error. Please
guide.



did this help?

octave:30> s='1,0,3,"Braund, Mr. Owen Harris",male,22,1,0,A/5 21171,7.25,C85,S'
s = 1,0,3,"Braund, Mr. Owen Harris",male,22,1,0,A/5 21171,7.25,C85,S
octave:31> textscan(s,'%d %d %d %s %s %s %d %d %d %s %f %s %s', 'delimiter',',');




 



--
View this message in context: http://octave.1599824.n4.nabble.com/Loading-CSV-file-into-Octave-tp4655023.html
Sent from the Octave - General mailing list archive at Nabble.com.
_______________________________________________
Help-octave mailing list
address@hidden
https://mailman.cae.wisc.edu/listinfo/help-octave



--
icq: 167498924
XMPP|Jabber: address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]