title: Selecting certain time range in Matlab
body: <p>I have a project to do and im facing some problems. Please help me. Im not so good at matlab yet. 
  Basically, I have a set of movement data (data.mat) which were recorded for 3 days non stop. And I need to:
  1. select only certain certain moments (time range) of this whole set of data 
  2. divide these moments into small 2.56 seconds parts
  3. make FFT of each small parts , to see the movement in frequency domain, and select only 5-25 Hz 
  4. find a few biggest frequency peaks</p>
  
  <p>I wrote a code for making FFT and peaks for whole my data "Data.mat"  and it is working. 
  This is my code:</p>
  
  <pre><code>load('Data.mat');
  P=data1(,2); %  
  Fs=100       
  Ts=1/Fs        
  L=length(P)     
  t = (0:L-1)*Ts;    
  nfft = 256    
  
  figure(1)      % raw signal plotting
  plot(t,P);
  
  y = fft(P,nfft)/L;       % FFT
  ymag = abs(y(1:length(y)/2+1));
  ft = Fs/2*linspace(0,1,nfft/2+1);
  
  figure(2)    % FFT plotting
  plot(ft,2*abs(y(1:nfft/2+1)))
  
  indx=ft&gt;= 5 &amp; ft&lt;= 25; % only 5-25Hz
  ftsub=ft(indx);
  ymagsub=ymag(indx);
  
  % highest peaks
  [pks,locs] = findpeaks(ymagsub,'MinPeakHeight',0.02)
  plot(ftsub,ymagsub,ftsub(locs),pks,'rv','MarkerFaceColor','r')
  </code></pre>
  
  <p>Now Im trying to select only certain moments of the data but I have problems with it. 
  E.g. lets say, I want select only time range: 13-03-2013 9:20:00-9:45:00 AM</p>
  
  <p>I have tried:</p>
  
  <pre><code>t_start =datenum('13-03-2013 9:20:00 AM', 'dd-mm-yyyy HH:MM:SS AM');
  t_end = datenum('13-03-2013 9:45:00 AM', 'dd-mm-yyyy HH:MM:SS AM');
  rows=find(P&gt;= t_start &amp; P&lt;= t_end); 
  </code></pre>
  
  <p>but I get answer:
      rows=
      Empty matrix: 0-by-1 </p>
  
  <p>Whats wrong? If this code is wrong, how to select certain time range then?
  And how to select into 2.56 seconds ?</p>
  
  <p>Please help me, Ive been trying to find the solution since weeks, im really depressed now. </p>