How to get additional output from Matlab Functions in Excel? Using matlabfcn?

If I put the following code in the command window, I get both the call and put option prices. [Call, Put] = blsprice(100, 95, 0.1, 0.25, 0.5)
If I put the following code in the command window, I can retrieve just the put price. [~, Put] = blsprice(100, 95, 0.1, 0.25, 0.5)
blsprice(100, 95, 0.1, 0.25, 0.5) by itself (without variable assignment) by default returns only the Call price.
How in excel (I have the spreadsheet link) can you get the second or any additional output that is calculated from a given function - using "matlabfcn" if possible? This is a generalized question but specifically I am looking at:
In excel, =matlabfcn("blsprice",100,95,0.1,0.25,0.5) returns only the default Call Price. Is there a flag to set to get the Put Price only?

Answers (1)

If you have Windows, with ActiveX you can put any text in a cell, like put "=matlabfcn("blsprice",100,95,0.1,0.25,0.5)" into cell A1. Excel will then compute the function value and you can use ActiveX or xlsread() to get the value back out. See my attached ActiveX demo.
If you don't know what ActiveX commands to issue, just record a macro in Excel and look at what it recorded.

Asked:

CKC
on 24 Oct 2016

Edited:

on 24 Oct 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!