help-octave
[Top][All Lists]
Advanced

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

Re: problems with latest strread (comma delimiters)


From: Philip Nienhuis
Subject: Re: problems with latest strread (comma delimiters)
Date: Wed, 19 Oct 2011 16:03:19 +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

Ben Abbott wrote:
On Oct 19, 2011, at 5:03 AM, PhilipNienhuis wrote:

krthie wrote:

Hi Philip

If you do not specify a delimiter character in strread calls, any
whitespace
character is supposed to be delimiter character. (Default whitespace = "
",
"\n", "\t", "\r"&  "b".)
However, if you do specify a delimiter, only that delimiter char is
actually
used and whitespace is simply ignored.

In your case,
[a1, a2] = strread ("1,2\n3,4\n", '%f%f', 'delimiter', ",\n")
works as desired.


OK. I understand this.(I'm not sure if that's how matlab works, but I
cannot
check it as I don't have access to a license at the moment.)


Maybe, but if ML works otherwise, its behavior would be at variance with its
own docs.
Wouldn't surprise me, BTW.


From ML.

[a1,a2]=strread(sprintf('1,2\n3,4\n'), '%f%f', 'delimiter',',')

a1 =

      1
      3

a2 =

      2
      4

This is consistent with how I read ML's docs. Are you saying it is  not?

The confusing issue (for me) is: exactly what is the difference between delimiter and whitespace?

Reading up the ML docs, I see that TMW has recently updated their on-line strread docs. (www.archive.com doesn't have the previous one on which I have based current strread.m's behavior.) It says: "...whitespace-separated numbers..." which leaves an ambiguity: are user-specified delimiters added to the whitespaces pool, or do they replace the default delimiter set which by default is whitespace?
I've always thought: the latter. But of course I may be wrong.
In case of the former: what then is the intention of ML's whitespace parameter, what exactly does that do?

BTW It is probably easy to change the behavior of Octave's strread.m. But some clarity is needed.

Philip


reply via email to

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