Map Time and Bond Cash Flows
This example shows how to use Financial Toolbox™ and Spreadsheet Link™ to calculate a set of cash flow amounts and dates for a portfolio of five bonds.
ExliSamp.xls file and select the Sheet6 worksheet.
For help finding the
ExliSamp.xls file, see Installation.
This worksheet contains the maturity dates and coupon rates for five bonds.
This example requires Financial Toolbox, Statistics and Machine Learning Toolbox™, and Optimization Toolbox™.
Execute the Spreadsheet Link function that transfers the column vector
Maturityto the MATLAB® workspace by double-clicking the cell
A18and pressing Enter.
Transfer the column vector
Coupon Rateto the MATLAB workspace by executing the function in cell
Transfer the settlement date to the MATLAB workspace by executing the function in cell
Calculate cash flow amounts and dates by executing the Financial Toolbox functions in cells
Transform the dates into a cell array of character vectors by executing the functions in cells
Transfer the data to the Excel® worksheet by executing the functions in cells
Display a plot of cash flows for each bond by executing the function in cell
To generate cash flows for a different set of five bonds, close
the figure and change the bond data in cells
Then, execute all the Spreadsheet Link functions again. The
worksheet updates with new cash flow dates and amounts and MATLAB generates
a new figure of the cash flows.