octave-maintainers
[Top][All Lists]
Advanced

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

RE: RE: 2.9.9+ for Windows


From: John W. Eaton
Subject: RE: RE: 2.9.9+ for Windows
Date: Mon, 12 Mar 2007 11:26:18 -0400

On 12-Mar-2007, address@hidden wrote:

| I tried the following under my local octave version (newer than the one
| you're using, but AFAIK there should not be any difference regarding
| read/writing numbers to file):
| 
| fid = fopen('ttt.mat', 'wb');
| x = rand(1,100)+i*rand(1,100);
| fwrite(fid, real(x), 'float32');
| fwrite(fid, imag(x), 'float32');
| fclose(fid);
| 
| fid = fopen('ttt.mat', 'rb');
| rx = single(fread(fid, [100,1], 'float32'));
| ix = single(fread(fid, [100,1], 'float32'));
| fclose(fid);
| 
| max(abs(x.'-xx)) => 4.1456e-008
| 
| So it seems to work OK. Did you open the files in binary mode? This
| might be the problem as files are opened in text mode by default under
| Windows; hence they suffer CRLF conversion.

Except that Octave's fopen should be forcing binary mode on all files
unless "t" is specified in the fopen flags.  If that isn't happening,
then I think it is a bug.

jwe


reply via email to

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