MATLAB: Bnddury function / Financial toolbox

Financial Toolboxfixed income

If I set the following: Yield=0.11245;CouponRate=0.175;Settle='04-Apr-12';Maturity='04-Oct-13';Period=12;Basis=0;… EndMonthRule=1;IssueDate='04-Apr-12';FirstCouponDate='04-Oct-13';LastCouponDate='04-Oct-13';… StartDate='04-Apr-12';Face=10654.48;
[ModDuration, YearDuration, PerDuration] = bnddury(Yield,CouponRate, Settle, Maturity,… Period, Basis, EndMonthRule,IssueDate,FirstCouponDate,LastCouponDate,StartDate,Face)
I get the following answer (quote): ??? Undefined function or variable "CFMQDates".
Error in ==> cfamounts at 739 CFMask = CFMQDates(Ind,:) <= Settle(Ind, ones(1,size(CFMQDates,2)));
Error in ==> bnddury at 187 [CFlowAmounts, ~, TFactors] = cfamounts(CouponRate, Settle, Maturity, varargin{:});
Error in ==> MyDurr at 28 [ModDuration, YearDuration, PerDuration] = bnddury(Yield,CouponRate, Settle, Maturity,…
(unquote)
If I set Period=0 than it is okay. What is the problem there? Can it be debugged (try and catch possibly)?

Best Answer

Well it looks like CFMQDates has not been assigned to anything before you attempt to use it. Of course it can be debugged. Set a breakpoint and then use F10 to step on/over lines/functions and F11 to step inside functions. For more debugging help, go here: http://blogs.mathworks.com/videos/2012/07/03/debugging-in-matlab/