[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #33876] textscan: resuming reading does not wo
From: |
Ben Abbott |
Subject: |
[Octave-bug-tracker] [bug #33876] textscan: resuming reading does not work |
Date: |
Sun, 31 Jul 2011 17:57:39 +0000 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.122 Safari/534.30 |
Follow-up Comment #5, bug #33876 (project octave):
Philip, thanks for the summary.
I thought I should mention that jwe plans to work on this part of the code,
But on a different problem. I think it is the same problem reported in the bug
here -> https://savannah.gnu.org/bugs/?33875
Oct 2010
Thread: advice / help needed for reading formatted text (textscan, strread, &
textread)
https://mailman.cae.wisc.edu/pipermail/octave-maintainers/2010-November/021513.html
I wrote another test script to help me understand how ML's implementation of
textscan() parses files. The isequal() checks each return true for ML.
filename = 'fubar.txt';
fid = fopen (filename, 'w');
for n = 1:2:20
fprintf (fid, '%d %dn', n + [0 1])
endfor
fclose (fid);
fid = fopen (filename, 'r');
c1 = textscan (fid, '%d %d', 1);
c2 = textscan (fid, '%d %d', 2);
c3 = textscan (fid, '%d %d', 3);
fclose (fid);
isequal (c1, {[1] [2]})
isequal (c2, {[3; 5] [4; 6]})
isequal (c3, {[7; 9; 11] [8; 10; 12]})
fid = fopen (filename, 'r');
c1 = textscan (fid, '%d', 1);
c2 = textscan (fid, '%d %d', 3);
c3 = textscan (fid, '%d %d', 3);
fclose (fid);
isequal (c1, {1})
isequal (c2, {[2; 3; 5] [0; 4; 6]})
isequal (c3, {[7; 9; 11] [8; 10; 12]})
fid = fopen (filename, 'r');
c1 = textscan (fid, '%d', 5);
c2 = textscan (fid, '%d %d', 2);
c3 = textscan (fid, '%d %d %d', 3);
fclose (fid);
isequal (c1, {[1;2;3;4;5]})
isequal (c2, {[6;7], [0;8])
isequal (c3, {[9;11;13], [10;12;14], [0;0;0]})
delete (filename)
The patch I've attached (the 2nd one) functions correctly the first time the
file is read (the developers version does not).
The second and third examples have failures. In the second example, ML's
result reads "0" for c2{2}(1,1). Looking at the contents of fubar.txt ...
1 2
3 4
5 6
7 8
9 10
11 12
13 14
15 16
17 18
19 20
The "0"'s in both the 2nd and 3rd examples occur when textscan reads beyond an
EOL.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?33876>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #33876] textscan: resuming reading does not work, Philip Nienhuis, 2011/07/28
- [Octave-bug-tracker] [bug #33876] textscan: resuming reading does not work, Ben Abbott, 2011/07/30
- [Octave-bug-tracker] [bug #33876] textscan: resuming reading does not work, Ben Abbott, 2011/07/30
- [Octave-bug-tracker] [bug #33876] textscan: resuming reading does not work, Ben Abbott, 2011/07/30
- [Octave-bug-tracker] [bug #33876] textscan: resuming reading does not work, Philip Nienhuis, 2011/07/31
- [Octave-bug-tracker] [bug #33876] textscan: resuming reading does not work,
Ben Abbott <=
- [Octave-bug-tracker] [bug #33876] textscan: resuming reading does not work, Philip Nienhuis, 2011/07/31
- [Octave-bug-tracker] [bug #33876] textscan: resuming reading does not work, Ben Abbott, 2011/07/31
- [Octave-bug-tracker] [bug #33876] textscan: resuming reading does not work, Rik, 2011/07/31