octave-maintainers
[Top][All Lists]
Advanced

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

Re: strread.m


From: Philip Nienhuis
Subject: Re: strread.m
Date: Wed, 03 Aug 2011 00:41:00 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.11) Gecko/20100701 SeaMonkey/2.0.6

John W. Eaton wrote:
On  2-Aug-2011, Philip Nienhuis wrote:

| But I'd like to know if directly reading (by some sscanf or so) e.g., an
| int8 from a string is superior (in the sense of conversion errors) to
| casting from double to int8. (and int16, int64, unsigned int8, ...)

I would think it would be fine for all except int64, because a double
can only handle integers up to 52 bits exactly.

I interpret this as "reading all numeric fields as double, convert afterwards to desired format by casting is OK (save int64)".

Well, that is a nice start for implementing the rest of the "regular" format conversion specifiers. Thank you.

Looking at the documentation for Matlab's textscan and strread
functions, they seem to be significantly different, and textscan seems

Not so much different. There's ample overlap.

to have many more format options.  So why handle textscan with
strread?

Because Octave's textscan has been written that way.
Perhaps the thinking was along the lines of "there's a scripted strread.m available; a binary strread replacement can easily be swapped in as soon as there is one."
Ben might be able to tell you more (he is the author of textscan).

Anyway, would there be a problem in extending (parts of) Octave's strread (and textread) versatility beyond that of Matlab's? I guess not.

Philip


reply via email to

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