Financial Time Series | ![]() ![]() |
Description
subsref
implements indexing for a financial time series object. Integer indexing or date string indexing is allowed. Serial dates numbers may not be used as indices.
To use date string indexing, enclose the date string(s) in a pair of single quotes '
'
.
You can use integer indexing on the object as in any other MATLAB matrix. It will return the appropriate entry(ies) from the object.
Additionally, subsref
lets you access the individual components of the object using the structure syntax.
Examples
Create a time series named myfts
.
myfts = fints((datenum('07/01/98'):datenum('07/01/98')+4)',... [1234.56; 2345.61; 3456.12; 4561.23; 5612.34], [], 'Daily',... 'Data Reference');
Extract the data for the single day July 1, 1998.
myfts('07/01/98') ans = desc: Data Reference freq: Daily (1) 'dates: (1)' 'series1: (1)' '01-Jul-1998' [ 1234.6]
Now, extract the data for the range of dates July 1, 1998 through July 5, 1998.
myfts('07/01/98::07/03/98') ans = desc: Data Reference freq: Daily (1) 'dates: (3)' 'series1: (3)' '01-Jul-1998' [ 1234.6] '02-Jul-1998' [ 2345.6] '03-Jul-1998' [ 3456.1]
You can use the MATLAB structure syntax to access the individual components of a financial time series object. To get the description field of myfts
, enter
myfts.desc
at the command line, which returns
ans = Data Reference
myfts.series1
ans = desc: Data Reference freq: Daily (1) 'dates: (5)' 'series1: (5)' '01-Jul-1998' [ 1234.6] '02-Jul-1998' [ 2345.6] '03-Jul-1998' [ 3456.1] '04-Jul-1998' [ 4561.2] '05-Jul-1998' [ 5612.3]
See Also
datestr
in the Financial Toolbox User's Guide.
![]() | subsasgn | times | ![]() |