How to Execute a Custom MATLAB Function in Excel
Execute a custom MATLAB® function using data from Microsoft® Excel® and display the results in Excel. The reason is to extend Excel with the computational and visualization capabilities of MATLAB. The custom MATLAB function creates random stock paths using Monte Carlo simulation. It simulates random stock paths using Geometrical Brownian Motion.
In this video I am going to show you how to execute a custom MATLAB function using data from MS Excel and display the results in Excel. The reason is to extend Excel with the computational and visualization capabilities of MATLAB.
The custom MATLAB function creates random stock paths using Monte Carlo simulation.
Monte Carlo simulation of a stochastic process is a procedure for sampling random outcomes for the process.
The custom function that I created, Paths, takes as inputs the GBM parameters and generates the stock paths. In this example we will generate 65,000 EuroStoxx paths for 21-time steps and visualize 500 paths starting at S0, which is the last available price for the index in question.
- First, we bring the Excel data into MATLAB.
- Next, we execute the custom function in MATLAB Paths.
- Finally, we bring the results back to Excel. The data in the worksheet updates.
We can see the 65,000 paths generated for 21-time steps.
To recap, using Spreadsheet Link, you can import a function already created in MATLAB and benefit from the computational speed and visualization capabilities of MATLAB directly from Excel.
To find out more about Spreadsheet Link applications, please visit the Spreadsheet Link product page where you can read the documentations, watch additional videos, and find examples. Thank you for watching.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
- América Latina (Español)
- Canada (English)
- United States (English)
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- United Kingdom (English)
- Australia (English)
- India (English)
- New Zealand (English)
- 日本Japanese (日本語)
- 한국Korean (한국어)