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: Ben Abbott
Subject: Re: problems with latest strread (comma delimiters)
Date: Wed, 19 Oct 2011 12:36:28 -0400

On Oct 19, 2011, at 10:03 AM, Philip Nienhuis wrote:

> 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

I was looking at this several months back. To refine my understanding, I had to 
run several examples.

Unfortunately, I don't trust the details of my memory, but if you'd like I can 
run examples for you.

Ben




reply via email to

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