Main Content

resamplets

Downsample data

resamplets is not recommended. Use timetable instead. For more information, see Convert Financial Time Series Objects fints to Timetables.

Description

example

newfts = resamplets(oldfts,samplestep) downsamples the data contained in the financial time series object oldfts every samplestep periods. For example, to have the new financial time series object contain every other data element from oldfts, set samplestep to 2.

newfts is a financial time series object containing the same data series (names) as the input oldfts.

Examples

collapse all

  1. Create a fints object.

    dates_and_times = (now:now+5)'
    dates_and_times =
    
       1.0e+05 *
    
        7.3840
        7.3840
        7.3840
        7.3841
        7.3841
        7.3841
    
     tsobj = fints(dates_and_times, randn(6,1))
    Warning: FINTS is not recommended. Use TIMETABLE instead. For more information, see Convert Financial Time Series Objects (fints) to Timetables. 
    > In fints (line 169) 
    tsobj = 
     
        desc:  (none)
        freq:  Unknown (0)
    
        {'dates:  (6)'}    {'times:  (6)'}    {'series1:  (6)'}
        {'07-Sep-2021'}    {'12:30'      }    {[       0.5377]}
        {'08-Sep-2021'}    {'12:30'      }    {[       1.8339]}
        {'09-Sep-2021'}    {'12:30'      }    {[      -2.2588]}
        {'10-Sep-2021'}    {'12:30'      }    {[       0.8622]}
        {'11-Sep-2021'}    {'12:30'      }    {[       0.3188]}
        {'12-Sep-2021'}    {'12:30'      }    {[      -1.3077]}
  2. Calculate the natural logarithm using log.

    newfts = resamplets(tsobj,2)
    Warning: FINTS is not recommended. Use TIMETABLE instead. For more information, see Convert Financial Time Series Objects (fints) to Timetables. 
    > In fints/resamplets (line 18) 
     
    newfts = 
     
        desc:  RESAMPLES of 
        freq:  Unknown (0)
    
        {'dates:  (3)'}    {'times:  (3)'}    {'series1:  (3)'}
        {'03-Sep-2021'}    {'17:10'      }    {[       1.4193]}
        {'05-Sep-2021'}    {'17:10'      }    {[       0.1978]}
        {'07-Sep-2021'}    {'17:10'      }    {[      -0.8045]}

Input Arguments

collapse all

Financial time series object, specified as a fints object.

Data Types: object

Sample period, specified as an integer.

Data Types: double

Output Arguments

collapse all

Financial time series object, returned as a fints object.

Version History

Introduced before R2006a