function C = segmentByClicks(F)
% F is a string that names a .wav file (including the suffix.)
% Prompts the user to enter the breakpoints and subsequently sets
% up a structure array C with the property that C(k).z
% is the array of sound values for the kth segment and C(k).rate
% is the associated sampling rate...

% Read and display the file:
  [data,rate] = wavread(F);
  close all
  plot(data)
  title('Enter n breakpoints left to right.  Press ENTER to stop.')

% Enter the breakpoints...
  [x,y] = ginput;  % (x(k),y(k)) is the location of the k-th mouse click
  x = floor(x);
  
% Set up C...
  nSegments = length(x)-1
  for k=1:nSegments
      first = x(k);
      last =  x(k+1)-1;
      z = data(first:last);
      C(k) = struct('rate',rate,'z',z);
  end  
    
    
