title: Calculating binary signal frequency & duration
body: <p>I am trying to analyze some signal data collected at 120 Hz. I have Excel and SPSS at my disposal (as well as MATLAB, but I'm not really familiar with it). I've been searching online for about and hour and half and can't seem to find what I'm looking for although I know it should be relatively simple.</p>
  
  <p>I have a list of 0's and 1's. I would like to calculate the duration of each signal then graph the frequency distribution of signals (ie., a histogram depicting percent of signals @ 1/10th sec, percent of signals @ 2/10ths sec, @ 3/10ths sec... @ 1 sec, and so on). I believe it is an inverse cumulative distribution I'm looking for but before I can get to that, I need to process the data in my spreadsheets. </p>
  
  <p>I'm having trouble figuring out how to sum each "group" of ones to get the duration of each signal. It would do something like this: for a cell containing a 1, if the cell above contains a 0, that starts a new sum and continues summing the 1's until a 0 appears. By the end of the spreadsheet, I would have a list of signal durations (expressed in terms of 1/120th of a sec -- ie., 30 would be 0.25 seconds)</p>
  
  <p>I've got over 100 files to process, so I'm looking for a formula or macro to do this quickly for each file. </p>
  
  <p>I have data for 4 different devices and I'm looking to compare these signal distributions by device. 
  Would I better off doing this in excel, spps or matlab?</p>
  
  <p>Thank you!</p>
  
  <p>The data is formatted in columns - I have frame count in column A and signal in column B (0 or 1). Each frame is 1/120th sec (I have thousands of frames per file). I'm not interested in the waveform, per se -  I'm doing this for statistical purposes to detect if the distribution of long vs short signals is significantly different between conditions. Ultimately I'd like a list of the signal lengths that I could represent in a histogram of Frequency (and by frequency, I don't mean wave freq but rather the number of occurrences. </p>