Dear Michael Goffioul,
Thank you so much for your quick response.
The file opened is of binary format:
% 'wb' -
write binary.
% 'ieee-(b/l)e' - IEEE floating point with endian
byte ordering
% and
32-bit data type.
[ignore ignore
endian] = computer;
storeFormat = sprintf('ieee-%se', lower(endian));
[fid, message] = fopen(sdgOPath, 'wb', storeFormat);
Later, the same file is opened for reading
as follows:
[fid, message] = fopen(fullfile(OPATH, SDGO, filename), 'r');
Please let me know if you would like me to
resend our script set.
Kind thanks,
Theresa
Theresa Meuse
MIT Lincoln Laboratory
244 Wood Street
Lexington, MA
02420
(781) 981-4066
www.ll.mit.edu
From: address@hidden
[mailto:address@hidden
Sent: Monday, March 12, 2007 4:11
AM
To: address@hidden;
address@hidden; address@hidden
Cc: address@hidden;
address@hidden
Subject: RE: RE: 2.9.9+ for
Windows
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.
Does the above code works for you? Or is your problem something
else?
Michael.
Dear Michael Goffioul,
This is the same as my earlier email, butwithout the attached scripts (hence it is no longer 6MB).
Please note that I do not use cygwin
(would I have better luck if I did?) and has MSWindows
XP Professional 2002 SP 2 running on an Intel(R) Pentium® 4 CPU3.60GHz
3.59GHz, 1.00 GB of RAM.
=======================================================================
I have been asked to make SSCA #3 v1.02, HPCS’slatest
Synthetic Aperture RadarBenchmark,
compatible with Octave under Windows, using this build:
GNU Octave 2.9.9+ version from Michael Goffioul http://www.dbateman.org/octave/octave_20070126(2.9.9+)_setup.exe
However it retrieves data erroneously from storage:
OCTAVE 2.9.9+
fwriteSDG.m? COMPUTE_MODE data write:
***DB: ftfMRow = 754, ftfNCol = 1.
***DB: kSize = 754, kuSize = 762.
***DB: uSize = 762, ucSize = 320.
freadStage1Start.m? COMPUTE_MODE data read:
***DB: ftfMRow = 754, ftfNCol = 1.
***DB: kSize = 754, kuSize = 762.
***DB: uSize = 762, ucSize = 320.
***DB: fastTimeFilterR = 82x 1.
***DB: fastTimeFilterI = 0x 1.
***DB: k = 0 x 1.
***DB: ku = 0 x 1.
***DB: u = 0x 1.
***DB: uc = 0 x 1.
Whereas with MATLAB (also Linux Octave 2.9.5):
fwriteSDG.m? COMPUTE_MODE data write:
***DB: ftfMRow = 754, ftfNCol = 1.
***DB: kSize = 754, kuSize = 762.
***DB: uSize = 762, ucSize = 320.
freadStage1Start.m? COMPUTE_MODE data read:
***DB: ftfMRow = 754, ftfNCol = 1.
***DB: kSize = 754, kuSize = 762.
***DB: uSize = 762, ucSize = 320.
***DB: fastTimeFilterR = 754 x 1.
***DB: fastTimeFilterI = 754 x 1.
***DB: k = 1 x754.
***DB: ku = 1 x 762.
***DB: u = 1 x762.
***DB: uc = 1 x 320.
***DB: fastTimeFilter = 754 x 1.
The script snippets that produce these results are:
fwriteSDG.m? COMPUTE_MODE data write:
%
Storecomplex components, real part first, then
imaginary.
fwrite(fid, real(fastTimeFilter), 'float32');
fwrite(fid, imag(fastTimeFilter),'float32');
fwrite(fid, k, 'float32');
fwrite(fid, ku, 'float32');
fwrite(fid, u, 'float32');
fwrite(fid, uc, 'float32');
freadStage1Start.m? COMPUTE_MODE data read:
% Retrievecomplex
raw SAR components real part first, then
% imaginary. (Note that Matlab 7 SP2's FREAD promotes todouble.)
fastTimeFilterR =single(fread(fid, [ftfMRow,ftfNCol],'float32'));
fastTimeFilterI = single(fread(fid,[ftfMRow,ftfNCol], 'float32'));
k =single(fread(fid, [1,kSize], 'float32'));
ku = single(fread(fid, [1,kuSize], 'float32'));
u =single(fread(fid, [1,uSize], 'float32'));
uc = single(fread(fid, [1,ucSize], 'float32'));
I am wondering if you can recommend me another Octave for Windowsbuild that I could try testing with.
Kind thanks,
Theresa
Theresa Meuse
MIT LincolnLaboratory
244 Wood Street
Lexington, MA 02420
(781) 981-4066
www.ll.mit.edu