help-octave
[Top][All Lists]
Advanced

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

Re: Textscan and csv fitness data problem


From: PhilipNienhuis
Subject: Re: Textscan and csv fitness data problem
Date: Wed, 3 Jan 2018 01:19:28 -0700 (MST)

bpabbott wrote
>> On Jan 1, 2018, at 11:51 AM, PhilipNienhuis <

> pr.nienhuis@

> > wrote:
>> 
>> NJank wrote
>>> On Jan 1, 2018 12:13 PM, "PhilipNienhuis" <
>> 
>>> pr.nienhuis@
>> 
>>> > wrote:
>>> 
>>> NJank wrote
>>>> On Jan 1, 2018 9:06 AM, "Thomas Esbensen"
>>> 
>>> 
>>> As to textscan, Dan did a lot of good work lately, I think the bugs you
>>> implied have been fixed in the development branch.
>>> 
>>> 
>>> Yeah, i noticed that. Would those make it into a 4.2.2 or not until
>>> 4.4.0?
>>> Been keeping my fingers crossed that it would suddenly "just work" and I
>>> wouldn't have to dive into his data again.
>> 
>> Have a look in the log: http://hg.savannah.gnu.org/hgweb/octave
>> bugs 52116 and 52479 have been fixed on stable, the last one (bug 52550)
>> not. If you want you can ask in the latter bug report to backport it to
>> stable.
>> 
>> As to csv2cell's erroneous column conversion, I've fixed that stupid bug
>> and
>> pushed it. To use it, get csv2cell.cc from here:
>> 
>> http://hg.code.sf.net/p/octave/io/file/31b7ff5ee040/src/csv2cell.cc
>> 
>> and then do
>> 
>> mkoctfile csv2cell.cc
>> 
>> to build a fixed version. Swap it into place, using 
>> "pkg load io; which csv2cell" 
>> to find out where it should live, followed by 
>> "pkg unload io; clear -f"
>> to clear the way for copying (otherwise csv2cell.oct is locked), and then
>> copy csv2cell.oct into place.
>> 
>> Philip
> 
> The original file has lines with a varied number of columns.  As a result
>
> 
> error: csv2cell: incorrect CSV file, line 2 too short
> 
> The first row are the column labels (127 of them), and 2nd row only has 19
> columns (18 commas). There are other rows deep in the file with 127
> columns too.

Sure but if you try csv2cell with as 2nd argument a spreadsheet-style range,
it'll read .csv files with a varying nr. of data per row just fine, see my
first answer in this thread.
If you want to read all of the file, just supply a sufficiently large range;
it'll fill empty fields beyond current line length with "" (empty string).
See "help csv2cell"

The only practical limit is the max line length of 4096 chars (a #DEFINEd
setting; changing that is easy as csv2cell() is just an .oct file).

(of course, as usual I can only vouch for csv2cell() to work fine on the 4
boxes I have access to: my 2 multiboot Linux/Win7/Win10 boxes + 2 Win7 boxes
at work.)

Philip




--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



reply via email to

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