%% Calculate the Next Coupon Date After the Settlement Date
% Determine the NextCouponDate when using character vectors for input arguments.

NextCouponDate = cpndaten('14-Mar-1997', '30-Nov-2000', 2, 0, 0);
datestr(NextCouponDate)

%
% Determine the NextCouponDate when using datetime arrays for input arguments.

NextCouponDate = cpndaten('14-Mar-1997', datetime('30-Nov-2000','Locale','en_US'),...
2, 0, 0)

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

NextCouponDate = cpndaten('14-Mar-1997', '30-Nov-2000', 2, 0, 1);
datestr(NextCouponDate)

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

Maturity = ['30-Sep-2000'; '31-Oct-2000'; '30-Nov-2000'];
NextCouponDate = cpndaten('14-Mar-1997', Maturity);
datestr(NextCouponDate)

% Copyright 2012 The MathWorks, Inc.