|
On 6/5/2011 11:40 PM, Roger Stafford wrote:
> dpb <none@non.net> wrote in message <ishk5t$aq$1@speranza.aioe.org>...
>> On 6/5/2011 9:47 PM, chitra ranganath wrote:
>> > hi i want to count total no of bits in this example zb= 00000100 1 0
>> > 01000100 0 00111110 0 01000100 0 00000100 0 00000010 this includes a
>> > delimiter space too so i don`t knw how do i write a code for this
>>
>> sum(zb=='1')
>>
>> Assuming it is in character format ("includes a delimiter space" don't
>> see that it could be anything else, just saying)...
> - - - - - - - - -
> Since zeros are bits too, I would think the total number of bits should be:
>
> sum(zb=='1'|zb=='0')
Hmmmmm....I interpreted it as total number of set bits but you're right
he doesn't say that exactly.
Guess OP can choose which it is wants.
--
|