help-octave
[Top][All Lists]
Advanced

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

RE: fread using bit8


From: Hoffman, Christopher S
Subject: RE: fread using bit8
Date: Thu, 11 Aug 2011 09:33:03 -0700

Cool, so looks like int8 and uint8 can work the same as bit8 and ubit8? I'll 
give it a shot 

-----Original Message-----
From: Ben Abbott [mailto:address@hidden 
Sent: Thursday, August 11, 2011 5:29 AM
To: Hoffman, Christopher S
Cc: address@hidden
Subject: Re: fread using bit8

On Aug 10, 2011, at 10:10 PM, Hoffman, Christopher S wrote:

> -----Original Message-----
> From: Ben Abbott [mailto:address@hidden
> Sent: Wednesday, August 10, 2011 6:04 PM
> To: Hoffman, Christopher S
> Cc: address@hidden
> Subject: Re: fread using bit8
> 
>> On Aug 10, 2011, at 8:12 PM, Hoffman, Christopher S wrote:
>> 
>>> I am trying to use the fread command on bit8 binary data. Octave does not 
>>> support that, is there a workaround?
>> 
>> I haven't tried to do this before, but if you can provide a complete example 
>> for me I (or someone else) can try to debug it, or find a work around.
>> 
>> Also please tell us what version of Octave you are running.
>> 
>> Ben
> 
> Thanks Ben: I will work on an example for you. I am using version 3.2.4.
> 
> Chris

Chris, I tried a short example that works for me.

fid = fopen ('fubar.bin', 'wb');
fwrite (fid, magic (5), 'int8');
fclose (fid);
fid = fopen ('fubar.bin','rb');
a = fread (fid, [5,5], 'int8')
fclose (fid);

a =

  17   24    1    8   15
  23    5    7   14   16
   4    6   13   20   22
  10   12   19   21    3
  11   18   25    2    9

Ben



reply via email to

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