How to calculate time duration between two time intervals
    3 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Mekala balaji
      
 el 9 de Abr. de 2016
  
    
    
    
    
    Editada: Azzi Abdelmalek
      
      
 el 9 de Abr. de 2016
            Hi,
I have the following table of time, and I want to calculate the time elapsed between Initial and Final time.
Intial Time                  Final Time
1/28/2016 2:23:31.996 PM  1/28/2016 2:25:27.808 PM
1/28/2016 3:20:30.925 PM  1/28/2016 3:22:29.174 PM
1/30/2016 11:18:09.333 PM  1/31/2016 12:59:41.693 AM
1/30/2016 11:18:09.333 PM  2/1/2016 1:24:00.083 AM
2/1/2016 2:50:13.521 AM         2/1/2016 2:52:05.412 AM
Many thanks in advance,
0 comentarios
Respuesta aceptada
  Azzi Abdelmalek
      
      
 el 9 de Abr. de 2016
        
      Editada: Azzi Abdelmalek
      
      
 el 9 de Abr. de 2016
  
      Use etime function
v={'1/28/2016 2:23:31.996 PM'  '1/28/2016 2:25:27.808 PM'
'1/28/2016 3:20:30.925 PM'  '1/28/2016 3:22:29.174 PM'
'1/30/2016 11:18:09.333 PM'  '1/31/2016 12:59:41.693 AM'
'1/30/2016 11:18:09.333 PM'  '2/1/2016 1:24:00.083 AM'
'2/1/2016 2:50:13.521 AM'         '2/1/2016 2:52:05.412 AM'}
c1=datevec(v(:,1),'mm/dd/yyyy HH:MM:SS.FFF')
c2=datevec(v(:,2),'mm/dd/yyyy HH:MM:SS.FFF')
d=etime(c2,c1)
0 comentarios
Más respuestas (0)
Ver también
Categorías
				Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.
			
	Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!