octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #63415] Error in fwrite() or rand() or randn()


From: Arun Giridhar
Subject: [Octave-bug-tracker] [bug #63415] Error in fwrite() or rand() or randn(), I'm not sure
Date: Mon, 20 Mar 2023 16:38:36 -0400 (EDT)

Follow-up Comment #29, bug #63415 (project octave):

@nrjank: That's OK, the two bug reports are caused by the same problem as
Dmitri found out a couple days ago. That one is fwrite writes the wrong value.
This one is fwrite writes the wrong *number* of values. Almost certainly
that's because some characters are being converted into invalid utf-8 entries
and then not written. I'm tracking both.

What happens in Matlab if you remove the lines with stat, like this?

clear all

fid = fopen ("m_eye.bin", "wb", "ieee-le");
matA = eye (100,150);
n = fwrite (fid, matA, "double");
fclose(fid);

fid = fopen ("m_rand.bin", "wb", "ieee-le");
matB = rand (100,150);
n = fwrite (fid, matB, "double");
fclose(fid);

fid = fopen ("m_eye.bin", "rb");
matC = fread (fid, inf, "double");
fclose(fid);

fid = fopen ("m_rand.bin", "rb");
matD = fread (fid, inf, "double");
fclose(fid);

assert (all (matC == matA(:)))
assert (all (matD == matB(:)))

clear ans fid
whos


Can you see the file sizes being different in Windows explorer or the cmd.exe
shell?


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63415>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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