Skip to Main Content Skip to Search
Product Documentation

getabstime (tscollection) - Extract date-string time vector into cell array

Syntax

getabstime(tsc)

Description

getabstime(tsc) extracts the time vector from the tscollection object tsc as a cell array of date strings. To define the time vector relative to a calendar date, set the TimeInfo.StartDate property of the time-series collection. When the TimeInfo.StartDate format is a valid datestr format, the output strings from getabstime have the same format.

Examples

  1. Create a tscollection object.

    tsc = tscollection(timeseries([3 6 8 0 10]));
    
  2. Set the StartDate property.

    tsc.TimeInfo.StartDate = '10/27/2005 07:05:36';
    
  3. Extract a vector of absolute time values.

    getabstime(tsc)
    
    ans = 
    
        '27-Oct-2005 07:05:36'
        '27-Oct-2005 07:05:37'
        '27-Oct-2005 07:05:38'
        '27-Oct-2005 07:05:39'
        '27-Oct-2005 07:05:40'
    
  4. Change the date-string format of the time vector.

    tsc.TimeInfo.Format = 'mm/dd/yy';
    
  5. Extract the time vector with the new date-string format.

    getabstime(tsc)
    
    ans = 
    
        '10/27/05'
        '10/27/05'
        '10/27/05'
        '10/27/05'
        '10/27/05'
    

See Also

datestr | setabstime (tscollection) | tscollection

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS