[Top][All Lists]

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

Re: Textscan and csv fitness data problem

From: Philip Nienhuis
Subject: Re: Textscan and csv fitness data problem
Date: Thu, 4 Jan 2018 22:00:36 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0 SeaMonkey/2.48

Ben Abbott wrote:
On Jan 3, 2018, at 2:47 PM, Philip Nienhuis <address@hidden
<mailto:address@hidden>> wrote:

Sure, I sympathize with your (and probably anyone else's) expectation.
But csv2cell isn't so flexible yet.

I don’t know if it breaks something, but I commented out the two
if/error blocks that check for columns that are too short or too long,
and was able to read the file.

Looking at the code I think you run little risk there.

To be honest, I or rather the io package inherited csv2cell and its siblings cell2csv etc. from the old "general" (or was it the "miscellaneous" package) and I never bothered much about it save for some obvious and annoying bugs. Only recently, looking better at it, I realize a few -in hindsight- suboptimal choices have been implemented by the original author (who seems to have vanished from the face of the earth).

csv2cell is a lot more flexible than csvread and dlmread and only a little bit slower, so IMO it deserves more attention.

But, perhaps a better solution is to assume the 1st row contains all
intended columns.

Sure but I have several csv files where that isn't the case.
Yet this solution is probably the most practical one. If no range is supplied csv2cell could supply a warning (instead of an error) if one or more lines contain more fields than the first line, along the lines you suggested in an earlier post. I think that would be easy to implement and would also allow some code cleanup.


reply via email to

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