Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!l32g2000hse.googlegroups.com!not-for-mail
From: bennymacca <ben.c.mcdonald@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Manipulation of Binary Numbers
Date: Tue, 5 Feb 2008 15:53:40 -0800 (PST)
Organization: http://groups.google.com
Lines: 62
Message-ID: <74d47d21-3f70-43a0-ab8d-b58d163ffae4@l32g2000hse.googlegroups.com>
References: <c50dec66-3a80-4d42-922b-ddcaf5eaf357@l1g2000hsa.googlegroups.com> 
NNTP-Posting-Host: 203.5.217.3
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Trace: posting.google.com 1202255620 9400 127.0.0.1 (5 Feb 2008 23:53:40 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 5 Feb 2008 23:53:40 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: l32g2000hse.googlegroups.com; posting-host=203.5.217.3; 
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 
X-HTTP-Via: 1.0 ednwc503 (NetCache NetApp/6.0.2), 1.1 DIGger2 (NetCache 
Xref: news.mathworks.com comp.soft-sys.matlab:449486


David, you have missed my point

When i meant binary data stream, i meant the bits themselves. what i
do with them is not the issue, and is irrelevant here.

all i wanted to know was the best way to perform operations on single
bits at a time. i already know what the bits mean, but this does not
change the arithmetic performed on then.

if the binary stream was meant to be interpreted as integers or other,
then i would have converted to that, and there would not have been a
problem. but matlab seems to have little support for a "binary data
type" which is what i would like.

anyway, problem is solved now, thanks very much for your help

David  wrote:
> bennymacca <ben.c.mcdonald@gmail.com> wrote in message
> <c50dec66-3a80-4d42-922b-
> ddcaf5eaf357@l1g2000hsa.googlegroups.com>...
> > Hi
> >
> > I am working with a file that contains a serial data
> stream (i.e
> > binary data)
> > i an then storing this data into arrays. i.e the number
> 3 would look
> > like [ 0 0 1 1] etc
> >
> > what i want is a way of adding these numbers together.
> i.e [0 0 1 1] +
> > [0 0 0 1] = [0 1 0 0]
> >
> > at present, my idea is to write a short script that
> converts to
> > decimal, then add the other number, then convert back to
> an array
> > using dec2binvec and binvec2dec. a short function would
> do this, but i
> > would like an easier way to do this.
> >
> > Any ideas?
> > Cheers,
> > Ben
>
> not without a lot more information.  you say you have a
> stream of binary data... this doesn't mean anything.  any
> serial data stream contains binary data, bits... but bits
> is bits, concatenting bits out of a stream may or may not
> make anything meaningful.  for instance the series of bits
> [1 0 1 0 1 1 1 1] could be the decimal number 175
> represented in 8 bits, or it could be -81 decimal
> expressed in 2's complement in 8 bits.  or it could be the
> first 8 bits of a 64 bit double precision number, or one
> color of a 24 bit pixel in a huge image.  or it could be
> one letter of a text document.  or maybe its 4 bits of one
> character and 4 bits of the next one, how do you know
> where the pieces you want to work on start and stop??
> unless you know exactly what that group of bits represent
> arbitrarily converting them to a number and doing some
> kind of operation on the resulting number may or may not
> make any sense.