Plotting data with timestamps
    7 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
Hi,
I have some data from a sensor and corresponding timestamps. How do I plot this data? (x axis - timestamps, y-axis - data) plot function gives empty figures. Probably because timestamps cannot be put in a linear scale. I tried semilogx - this also gives empty figures.
How do I do this?
Thanks in advance
2 Commenti
Risposta accettata
  dpb
      
      
 il 28 Nov 2016
        
      Modificato: dpb
      
      
 il 28 Nov 2016
  
      Convert from whatever format the timestamps are in to a Matlab representation of dates...with R2014 up, there's the datetime class; prior to that use datenum. See  <datetime> for current versions; plot is datetime -aware.
7 Commenti
  Peter Perkins
    
 il 31 Ott 2018
				In recent versions of MATLAB, you can also convert directly from ms since 1970:
>> datetime(1489337264031,'ConvertFrom','EpochTime','TicksPerSecond',1000,'Format','dd-MMM-yyyy HH:mm:ss.SSS')
ans = 
  datetime
   12-Mar-2017 16:47:44.031
The 'Epoch' parameter defaults to 1-Jan-1970, which is convenient if you have posix timestamps.
Più risposte (0)
Vedere anche
Categorie
				Scopri di più su Dates and Time in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





