[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fread using bit8
From: |
Ben Abbott |
Subject: |
Re: fread using bit8 |
Date: |
Thu, 11 Aug 2011 20:05:39 -0400 |
On Aug 11, 2011, at 8:00 PM, Hoffman, Christopher S wrote:
>>
>> -----Original Message-----
>> From: Ben Abbott [mailto:address@hidden
>> Sent: Thursday, August 11, 2011 12:01 PM
>> To: Hoffman, Christopher S
>> Cc: address@hidden
>> Subject: Re: fread using bit8
>>
>>
>> On Aug 11, 2011, at 12:33 PM, Hoffman, Christopher S wrote:
>>
>>> -----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
>>>
>>> Cool, so looks like int8 and uint8 can work the same as bit8 and ubit8?
>>> I'll give it a shot
>>>
>>
>> I've submitted a bug report due to the missing "bitN" format.
>>
>> https://savannah.gnu.org/bugs/index.php?33991
>>
>> Ben
>>
>
> Ben: I tried using int8 and uint4 for bit8 and ubit4 respectively but octave
> doesn't like uint4. Tried uint8 and the results are not good. Here is an
> example, the last few lines in the .m code show what it should be. If you can
> get this working that would be awesome. Let me know how it goes, and thanks
>
> Chris
Off the top of my head, I don't have any additional suggestions.
Ben