MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: number of switches

  • To: mathgroup at smc.vnet.net
  • Subject: [mg47536] Re: number of switches
  • From: drbob at bigfoot.com (Bobby R. Treat)
  • Date: Thu, 15 Apr 2004 03:40:30 -0400 (EDT)
  • References: <c5j6vd$qqo$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

cases={{1,1,0,1},{1,1,0,0},{1,0,1,0,1}};
switches=-1+Length@Split@#&;
switches/@cases

{2,1,4}

Bobby

"fake" <fake at fake.it> wrote in message news:<c5j6vd$qqo$1 at smc.vnet.net>...
> Consider the lists {1,1,0,1} and {1,1,0,0},{1,0,1,0,1}.
> The first sequence (1101) switches 2 times (#2digit~#3digit,
> #3digit~#4digit}, the second (1100) 1 time, the third 10101 4 times.
> 
> I have the following problem.
> Consider a list of binary digits. Which is the easiest way to count the
> number of switches of the list (using Mathematica commands)?


  • Prev by Date: How to check if a file exists?
  • Next by Date: Re: number of switches
  • Previous by thread: Re: number of switches
  • Next by thread: Re: number of switches