help-octave
[Top][All Lists]
Advanced

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

Re: How can I declare an "uint8 RowVector"?


From: Roberto Vidmar
Subject: Re: How can I declare an "uint8 RowVector"?
Date: Mon, 16 Jan 2006 15:46:20 +0100
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050317)

John W. Eaton wrote:

On 16-Jan-2006, Roberto Vidmar wrote:

| I need to read and process a binary file made of 553 byte records. | Every record contains many data and, among these, 3 arrays of uint8 values. | First I wrote an octave function to store every record in an octave | structure using fread and uint8 convertion funcion: | | ...
| RpfRecord.ret2 = uint8(fread(rpfid, 220, 'uint8'));
| ...
| | ...but this is far to slow for my purpouses so I tried to move the
What version of Octave are you using?  With newer versions, including
2.1.72, you can write

 RpfRecord.ret2 = fread(rpfid, 220, 'uint8=>uint8');
...snip.

Thanks for your kind and quick answer. The version I'm running is 2.1.72 (i686-pc-linux-gnu), OS is RedHat 9 updated with yum. I followed your advice but I had no speed up. I suppose the problem is that I do to many fread call, this is why I'm trying to move the reading process into a C++ function. If I read every record with a single fread the speed up is impressive (more than 10 times faster) but doing so I am not able to split later the 553 byte uint8 vector into a structure. My record structure is the following:

 RpfRecord.gpstime      =       fread(rpfid, 1, 'real*8');
 RpfRecord.pulsecount   =       fread(rpfid, 1, 'int8');
 RpfRecord.range        =       fread(rpfid, 4, 'real*4');
 RpfRecord.intensity    =       fread(rpfid, 4, 'int16');
 RpfRecord.scanangle    =       fread(rpfid, 1, 'real*4');
 RpfRecord.roll         =       fread(rpfid, 1, 'real*4');
 RpfRecord.pitch        =       fread(rpfid, 1, 'real*4');
 RpfRecord.heading      =       fread(rpfid, 1, 'real*4');
 RpfRecord.aircraft_lat =       fread(rpfid, 1, 'real*8');
 RpfRecord.aircraft_lon =       fread(rpfid, 1, 'real*8');
 RpfRecord.aircraft_ele =       fread(rpfid, 1, 'real*4');
 RpfRecord.t1           =       fread(rpfid, 1, 'uint16');
 RpfRecord.t2           =       fread(rpfid, 1, 'uint16');
 RpfRecord.t0           = uint8(fread(rpfid, 40, 'uint8=>uint8'));
 RpfRecord.ret1         = uint8(fread(rpfid, 220, 'uint8=>uint8'));
 RpfRecord.ret2         = uint8(fread(rpfid, 220, 'uint8=>uint8'));

Roberto Vidmar

--
------------------------------------
Roberto Vidmar ___ __ __ OCEANOGRAFIA
/  / /__ /__    GEOFISICA
/__/ /__/ __/    SPERIMENTALE
Istituto Nazionale di Oceanografia e
di Geofisica Sperimentale
34010 Sgonico (TS) ITALY

Research Group: CARS
(Cartography And Remote Sensing)
CARS Group is certified ISO 9001:2000

Tel. +39 040 2140 336 direct
Tel. +39 040 2140 1  operator

E-mail: address@hidden
------------------------------------



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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