converting the time data into Datetime Format
    9 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    muhammad choudhry
      
 el 13 de Mzo. de 2022
  
    
    
    
    
    Comentada: Peter Perkins
    
 el 14 de Mzo. de 2022
            Hi,
     I am transfering the data from ultrasonic sensor into the excel file attached and using the code below but I am keep getting error that my data  not in right format, it ask me firstofall to read the data in matric rather then table I done both but still getting error. " i want to understand what am i doing wrong and how to correct it" please
Error while reading as table:
Error using datetime (line 597)
Numeric input data must be a matrix with three or six columns, or else three, six, or seven separate numeric arrays. You can also create datetimes from a
single numeric array using the 'ConvertFrom' parameter.
Error in dateformat (line 5)
th = datetime(Hdat.TimeStamp,'InputFormat','dd.MM.yyyy HH:mm:ss.SSS');
Error while reading as Matrix:
Dot indexing is not supported for variables of this type.
Error in dateformat (line 5)
th = datetime(Hdat.TimeStamp,'InputFormat','dd.MM.yyyy HH:mm:ss.SSS');
Code Used:
Hdat = readtable('F:\3-PIV_Experimental_Data\Outlet_110\Data_LaserSheet_D\Data_Head\Data_Raw\Head_Timestamps.xlsx');
th = datetime(Hdat.TimeStamp,'InputFormat','dd.MM.yyyy HH:mm:ss.SSS');
h = Hdat.Head_mm_; 
0 comentarios
Respuesta aceptada
  Arif Hoq
      
 el 13 de Mzo. de 2022
        try this syntax:
th = datetime(A.TimeStamp,'InputFormat','dd.MM.yyyy HH:mm:ss.SSS','ConvertFrom','datenum');
5 comentarios
  Arif Hoq
      
 el 13 de Mzo. de 2022
				try this:
th = datetime(A.TimeStamp,'Format','HH:mm:ss','ConvertFrom','datenum');
  Peter Perkins
    
 el 14 de Mzo. de 2022
				These are almost certainly NOT datetimes, but rather durations. See my response to your other, nearly identical, post:
Más respuestas (1)
  Walter Roberson
      
      
 el 13 de Mzo. de 2022
        As discussed in your other Question, the field in the file stores fraction of days in numeric form, and has no date information.
th = days(A.TimeStamp);
th.Format = 'hh:mm:ss' ;
0 comentarios
Ver también
Categorías
				Más información sobre Data Type Conversion en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




