%% Calculate the Number of Days in the Coupon Period Containing Settlement Date
% Determine the NumDaysPeriod when using character vectors for input arguments.

NumDaysPeriod = cpnpersz('14-Sep-2000', '30-Jun-2001', 2, 0, 0)

%
% Determine the NumDaysPeriod when using a datetime array for an input argument.

NumDaysPeriod = cpnpersz(datetime('14-Sep-2000','Locale','en_US'), '30-Jun-2001', 2, 0, 0)

%
% Determine the NumDaysPeriod when using character vectors for input arguments and the optional argument for EndMonthRule.

NumDaysPeriod = cpnpersz('14-Sep-2000', '30-Jun-2001', 2, 0, 1)

%
% Determine the NumDaysPeriod when using an input vector for Maturity.

Maturity = ['30-Apr-2001'; '31-May-2001'; '30-Jun-2001'];
NumDaysPeriod = cpnpersz('14-Sep-2000', Maturity)

% Copyright 2012 The MathWorks, Inc.