convert time stamp into minutes or seconds
    5 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
I have a file with
29.06.2014   09:53:37      -1.8
29.06.2014   09:58:36      -2.0
29.06.2014   10:39:01      -2.0
I would like to covert the second column into how long time past from the first readout in the column, in minutes or seconds and plot column 2 and 3. Matlab doesn't seem to be able to handle the ':' sign. How do I do this?
Many thanks!
0 Kommentare
Antworten (2)
  Jos (10584)
      
      
 am 1 Jul. 2014
        I assume the 3rd column represents a value.
[D,T,V] = textread('MyFile.txt','%s%s%f')
DT = datevec(strcat(D,'-',T),'dd.mm.yyyy-HH:MM:ss') % convert to matlab time vectors
dTsec = arrayfun(@(k) etime(DT(k,:),DT(1,:)),1:size(DT,1)) % relative time in seconds
0 Kommentare
  David Sanchez
      
 am 1 Jul. 2014
        Take a look at this thread, it deals right with your problem.
0 Kommentare
Siehe auch
Kategorien
				Mehr zu Language Fundamentals finden Sie in Help Center und File Exchange
			
	Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


