| Financial Derivatives Toolbox™ | ![]() |
IndexMatch = instfind(InstSet, 'FieldName',
FieldList, 'Data',
DataList,'Index', IndexSet,
'Type', TypeList)
InstSet | Variable containing a collection of instruments. Instruments are classified by type; each type can have different data fields. The stored data field is a row vector or string for each instrument. |
FieldList | String or number of fields (NFIELDS)-by-1 cell array of strings listing the name of each data field to match with data values. |
DataList | Number of values (NVALUES)-by-M array or NFIELDS-by-1 cell array of acceptable data values for each field. Each row lists a data row value to search for in the corresponding FieldList. The number of columns is arbitrary, and matching will ignore trailing NaNs or spaces. |
(Optional) Number of instruments (NINST)-by-1 vector restricting positions of instruments to check for matches. The default is all indices available in the instrument variable. | |
(Optional) String or number of types (NTYPES)-by-1 cell array of strings restricting instruments to match one of TypeList types. The default is all types in the instrument variable. |
Argument value pairs can be entered in any order. The InstSet variable must be the first argument. 'FieldName' and 'Data' arguments must appear together or not at all.
IndexMatch = instfind(InstSet, 'FieldName', FieldList, 'Data', DataList,'Index', IndexSet, 'Type', TypeList) returns indices of instruments matching Type, Field, or Index values.
IndexMatch is an NINST-by-1 vector of positions of instruments matching the input criteria. Instruments are returned in IndexMatch if all the Field, Index, and Type conditions are met. An instrument meets an individual Field condition if the stored FieldName data matches any of the rows listed in the DataList for that FieldName.
Retrieve the instrument set ExampleInst from the data file InstSetExamples.mat. ExampleInst contains three types of instruments: Option, Futures, and TBill.
load InstSetExamples; instdisp(ExampleInst) Index Type Strike Price Opt Contracts 1 Option 95 12.2 Call 0 2 Option 100 9.2 Call 0 3 Option 105 6.8 Call 1000 Index Type Delivery F Contracts 4 Futures 01-Jul-1999 104.4 -1000 Index Type Strike Price Opt Contracts 5 Option 105 7.4 Put -1000 6 Option 95 2.9 Put 0 Index Type Price Maturity Contracts 7 TBill 99 01-Jul-1999 6
Make a vector, Opt95, containing the indexes within ExampleInst of the options struck at 95.
Opt95 = instfind(ExampleInst, 'FieldName','Strike','Data','95')
Opt95 =
1
6
Locate the futures and Treasury bill instruments within ExampleInst.
Types = instfind(ExampleInst,'Type',{'Futures';'TBill'})
Types =
4
7
instaddfield, instget, instgetcell, instselect
![]() | instfields | instfixed | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |