octave-maintainers
[Top][All Lists]
Advanced

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

Re: unexpected textscan error


From: Ben Abbott
Subject: Re: unexpected textscan error
Date: Sat, 08 Oct 2011 18:31:42 -0400

On Oct 8, 2011, at 6:03 PM, Ben Abbott wrote:

> I don't know what change may have resulted in this test error, or if it is 
> something specific to my build or MacOS.
> 
> When I run "test strread", I see ...
> 
> test strread
>  ***** test
> # No delimiters at all besides EOL.  Plain reading numbers & strings
> str = "Text1Text2Text\nText398Text4Text\nText57Text";
> c = textscan (str, "Text%dText%1sText");
> assert (c{1}, int32 ([1; 398; 57]));
> assert (c{2}(1:2), {'2'; '4'});
> assert (isempty (c{2}{3}), true);
> !!!!! test failed
> some elements undefined in return list
> 
> Directly from the command line I see ...
> 
> str = "Text1Text2Text\nText398Text4Text\nText57Text";
> c = textscan (str, "Text%dText%1sText")
> error: some elements undefined in return list
> error: called from:
> error:   /Users/bpabbott/Development/mercurial/default/scripts/io/textscan.m 
> at line 221, column 11
> 
> Does anyone else see this?
> 
> Ben

Maybe this is also related to the error I see in textscan?

test textscan
  ***** test
 str = "Km:10 = hhhBjjj miles16hour\r\n";
 str = [str "Km:15 = hhhJjjj miles241hour\r\n"];
 str = [str "Km:2 = hhhRjjj miles3hour\r\n"];
 str = [str "Km:25 = hhhZ\r\n"];
 fmt = "Km:%d = hhh%1sjjj miles%dhour";
 a = textscan (str, fmt, 'delimiter', ' ');
 assert (a{1}', int32([10 15 2 25]));
 assert (a{2}', {'B' 'J' 'R' 'Z'});
 assert (a{3}', int32([16 241 3 0]));
!!!!! test failed
some elements undefined in return list

Running Matlab, I see ...

str = 'Km:10 = hhhBjjj miles16hour\r\n';
str = [str 'Km:15 = hhhJjjj miles241hour\r\n'];
str = [str 'Km:2 = hhhRjjj miles3hour\r\n'];
str = [str 'Km:25 = hhhZ\r\n'];
fmt = 'Km:%d = hhh%1sjjj miles%dhour';
a = textscan (str, fmt, 'delimiter', ' ');
a{:}

ans = 10

ans =   'B'

ans =  16




reply via email to

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