[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #65390] fscanf produces 1 line too much
From: |
A.R. Burgers |
Subject: |
[Octave-bug-tracker] [bug #65390] fscanf produces 1 line too much |
Date: |
Fri, 1 Mar 2024 10:10:48 -0500 (EST) |
URL:
<https://savannah.gnu.org/bugs/?65390>
Summary: fscanf produces 1 line too much
Group: GNU Octave
Submitter: arb
Submitted: Fri 01 Mar 2024 04:10:47 PM CET
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Release: dev
Discussion Lock: Any
Operating System: GNU/Linux
Fixed Release: None
Planned Release: None
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Fri 01 Mar 2024 04:10:47 PM CET By: A.R. Burgers <arb>
This example shows a case where fscanf fails I think to correctly read an
input:
np = 101;
x = linspace(0, 1, np)';
a = [x, x.^2];
dlmwrite('tst.dat', a, '\t');
fd = fopen('tst.dat', 'r');
ar = fscanf(fd, '%g %g', [2, Inf])';
fclose(fd);
ar(np - 5: end, :)
try
[a(np - 5 : end, :), ar(np - 5 : end, :)]
catch me
error('ran into %s', me.message);
end
octave output, featuring an extra row at the end:
ans =
0.9500 0.9025
0.9600 0.9216
0.9700 0.9409
0.9800 0.9604
0.9900 0.9801
1.0000 1.0000
1.0000 0
error: ran into horizontal dimensions mismatch (6x2 vs 7x2)
error: called from
tst at line 12 column 3
matlab output:
ans =
0.9500 0.9025
0.9600 0.9216
0.9700 0.9409
0.9800 0.9604
0.9900 0.9801
1.0000 1.0000
ans =
0.9500 0.9025 0.9500 0.9025
0.9600 0.9216 0.9600 0.9216
0.9700 0.9409 0.9700 0.9409
0.9800 0.9604 0.9800 0.9604
0.9900 0.9801 0.9900 0.9801
1.0000 1.0000 1.0000 1.0000
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?65390>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #65390] fscanf produces 1 line too much,
A.R. Burgers <=
- [Octave-bug-tracker] [bug #65390] fscanf produces 1 line too much, Dmitri A. Sergatskov, 2024/03/01
- [Octave-bug-tracker] [bug #65390] fscanf produces 1 line too much, Dmitri A. Sergatskov, 2024/03/01
- [Octave-bug-tracker] [bug #65390] fscanf produces 1 line too much, Dmitri A. Sergatskov, 2024/03/01
- [Octave-bug-tracker] [bug #65390] fscanf produces 1 line too much, Dmitri A. Sergatskov, 2024/03/01
- [Octave-bug-tracker] [bug #65390] fscanf produces 1 line too much, Rik, 2024/03/01
- [Octave-bug-tracker] [bug #65390] fscanf produces 1 line too much, John W. Eaton, 2024/03/01
- [Octave-bug-tracker] [bug #65390] fscanf produces 1 line too much, Dmitri A. Sergatskov, 2024/03/01
- [Octave-bug-tracker] [bug #65390] fscanf produces 1 line too much, Hendrik K, 2024/03/01
- [Octave-bug-tracker] [bug #65390] fscanf produces 1 line too much, Rik, 2024/03/02
- [Octave-bug-tracker] [bug #65390] fscanf produces 1 line too much, Rik, 2024/03/02