Path: news.mathworks.com!not-for-mail
From: "alan dinno" <alan_dinno@hotmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Conversion of Columns into Decimals
Date: Sat, 8 Dec 2007 04:36:48 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 61
Message-ID: <fjd710$73p$1@fred.mathworks.com>
References: <fjcsag$t98$1@fred.mathworks.com> <fjcu8k$mcp$1@fred.mathworks.com> <fjd062$fjd$1@fred.mathworks.com> <fjd1sg$6nm$1@fred.mathworks.com>
Reply-To: "alan dinno" <alan_dinno@hotmail.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1197088608 7289 172.30.248.38 (8 Dec 2007 04:36:48 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 8 Dec 2007 04:36:48 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1192926
Xref: news.mathworks.com comp.soft-sys.matlab:441528


"Roger Stafford" 
<ellieandrogerxyzzy@mindspring.com.invalid> wrote in 
message <fjd1sg$6nm$1@fred.mathworks.com>...
> "alan dinno" <alan_dinno@hotmail.com> wrote in message 
<fjd062$fjd
> $1@fred.mathworks.com>...
> > "Matt Fig" <spamanon@yahoo.com> wrote in message 
> > <fjcu8k$mcp$1@fred.mathworks.com>...
> > > "alan dinno" <alan_dinno@hotmail.com> wrote in 
message
> > > <fjcsag$t98$1@fred.mathworks.com>...
> > > > Hi - If matrix A contains only bits,I want a row 
> > vector B 
> > > > (with same length as size(A,2)) that contains the 
> > > > conversion of each column in A into Decimal.
> > > > 
> > > > Example:
> > > > 
> > > >  A =[ 1 1 0 1 0
> > > >       0 0 1 1 1
> > > >       1 1 1 0 1
> > > >       1 0 0 1 1 ]
> > > > 
> > > >  B=[bin2dec(A col 1),bin2dec(A col 2),bin2dec(A 
col 
> > 3),...]
> > > > 
> > > > Thanks
> > > > alan
> > > 
> > > 
> > > B = bin2dec(num2str(A'))'
> > 
> > Matt - I used it on a big matrix and gave the error:
> > 
> > "??? Error using ==> bin2dec
> > Binary string must be 52 bits or less."
> > 
> > Thanks
> > alan
> --------
>   If vector B is to consist of double precison floating 
point numbers (double), 
> these are capable of representing integers to only 53 
bits of precision, since 
> that is the number of bits in their significands.  The 
remaining bits of the 64 
> are needed for sign and exponent.  If the columns of A 
are longer than that, 
> your desired task is therefore impossible, in general, 
if you want exact 
> representation, and presumably that is why 'bin2dec' 
complained.
> 
> Roger Stafford
> 

Will it be possible if vector B contained only integers?

Thanks
alan