Complement of instrument set by matching conditions


ISubSet = instdelete(InstSet,'FieldName',FieldList,'Data',DataList,'Index',IndexSet,'Type',TypeList)



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 character vector for each instrument.


Number of fields, specified as a NFIELDS-by-1 cell array of character vectors listing the name of each data field to match with data values.


Number of values, specified as a 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 ignores trailing NaNs or spaces.


(Optional) Number of instruments, specified as a NINST-by-1 vector restricting positions of instruments to check for matches. The default is all indices available in the instrument variable.


(Optional) Number of types, specified as a NTYPES-by-1 cell array of character vectors 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.


The output argument ISubSet contains instruments not matching the input criteria. Instruments are deleted from ISubSet 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. See instfind for more examples on matching criteria.


Retrieve the instrument set variable ExampleInst from the data file InstSetExamples.mat. The variable contains three types of instruments: Option, Futures, and TBill.

load InstSetExamples; 
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      

Create a new variable, ISet, with all options deleted.

ISet = instdelete(ExampleInst, 'Type','Option');
Index Type    Delivery       F     Contracts
1     Futures 01-Jul-1999    104.4 -1000 
Index Type  Price  Maturity       Contracts
2     TBill 99     01-Jul-1999    6      

Introduced before R2006a