Main Content

classfin

Create financial structure or return financial structure class name

Description

example

Obj = classfin(ClassName) create a financial structure of class ClassName.

example

Obj = classfin(Struct,ClassName) create a converted MATLAB® financial structure of class ClassName.

example

ClassName = classfin(Obj) returns a character vector containing a financial structure's class name.

Examples

collapse all

This example shows how to create a financial structure HJMTimeSpec and complete its fields. (Typically, the function hjmtimespec is used to create HJMTimeSpec structures).

TimeSpec = classfin('HJMTimeSpec'); 
TimeSpec.ValuationDate = datenum('Dec-10-1999'); 
TimeSpec.Maturity = datenum('Dec-10-2002'); 
TimeSpec.Compounding = 2; 
TimeSpec.Basis = 0; 
TimeSpec.EndMonthRule = 1;
TimeSpec
TimeSpec = struct with fields:
           FinObj: 'HJMTimeSpec'
    ValuationDate: 730464
         Maturity: 731560
      Compounding: 2
            Basis: 0
     EndMonthRule: 1

This example shows how to convert an existing MATLAB structure into a financial structure.

TSpec.ValuationDate = datenum('Dec-10-1999'); 
TSpec.Maturity = datenum('Dec-10-2002'); 
TSpec.Compounding = 2; 
TSpec.Basis = 0; 
TSpec.EndMonthRule = 0; 
TimeSpec = classfin(TSpec, 'HJMTimeSpec')
TimeSpec = struct with fields:
    ValuationDate: 730464
         Maturity: 731560
      Compounding: 2
            Basis: 0
     EndMonthRule: 0
           FinObj: 'HJMTimeSpec'

This example shows how to obtain a character vector containing a financial structure's class name.

load deriv.mat 
ClassName = classfin(HJMTree)
ClassName = 
'HJMFwdTree'

Input Arguments

collapse all

Name of a financial structure class, specified by a character vector.

Data Types: char

Structure for conversion, specified as a MATLAB structure

Data Types: struct

Name of a financial structure, specified with an instance of an object.

Data Types: object

Output Arguments

collapse all

Name of a financial structure, returned as an instance of an object.

Name of a financial structure class, specified by a character vector.

Introduced before R2006a