Serving the Quantitative Finance Community

 
User avatar
SickMonkey
Topic Author
Posts: 3
Joined: March 13th, 2004, 7:24 pm

Using Excel with Matlab's GARCH toolbox

October 19th, 2005, 9:16 am

When I run the MATLAB code in the attached file in the Matab command window it executes without any problems. However, when I try to get the output to Excel, the functions return 0 to indicate that they executed correctly but do not return the GARCH estimations. Any advice as to how I can get the parameters generated in MATLAB into Excel would be much appreciated. Thanks in advance.
Attachments
Data1.zip
(4.83 KiB) Downloaded 67 times
 
User avatar
monarc
Posts: 0
Joined: June 21st, 2004, 2:35 pm

Using Excel with Matlab's GARCH toolbox

October 20th, 2005, 8:56 pm

There is NO matlab code in the zip file. moreover, are you using xllink or are you using xlswrite command to output the results to excel sheet??
 
User avatar
crisky
Posts: 0
Joined: May 24th, 2003, 9:21 pm

Using Excel with Matlab's GARCH toolbox

October 22nd, 2005, 5:15 am

The most robust way of getting the Matlab variables into Excel is thorough a VBA macro-you can use the MLGetMatrix() function in VBA to assign the Matlab variable to a named spreadsheet range.The important thing is to include the "MatlabRequest" command at the end of the macro- this forces an update of your range.(Using the MLGetMatrix() directly in the sheet and recalculating with Shift+F9 does not always update the range).
 
User avatar
crisky
Posts: 0
Joined: May 24th, 2003, 9:21 pm

Using Excel with Matlab's GARCH toolbox

October 22nd, 2005, 5:15 am

oops, hit the reply button too many times..
Last edited by crisky on October 21st, 2005, 10:00 pm, edited 1 time in total.
 
User avatar
crisky
Posts: 0
Joined: May 24th, 2003, 9:21 pm

Using Excel with Matlab's GARCH toolbox

October 22nd, 2005, 5:16 am

Last edited by crisky on October 21st, 2005, 10:00 pm, edited 1 time in total.
 
User avatar
SickMonkey
Topic Author
Posts: 3
Joined: March 13th, 2004, 7:24 pm

Using Excel with Matlab's GARCH toolbox

October 27th, 2005, 7:35 am

Thanks for you help. Monarc, perhaps I should have explained myself better, I was referring to the Matlab code that is emedded in the function in cell C4 ie "Results = garchfit(Data)" and I'm using the Excel Link. I have taken up Crisky's suggestion to use VBA however but the code still does not return the desired results. And yes I have established a reference to Matlab's excel link. Thanks
Attachments
Data2.zip
(8.3 KiB) Downloaded 63 times
 
User avatar
SickMonkey
Topic Author
Posts: 3
Joined: March 13th, 2004, 7:24 pm

Using Excel with Matlab's GARCH toolbox

November 2nd, 2005, 11:59 am

I've written some VBA code that seems to fix the problem, I'm posting it here in case it of use to anyone. While I appreciate that its probably very inefficient (I'm very much a novice) it seems to work OK. Thanks for all your suggestions
Attachments
Data 3.zip
(12.44 KiB) Downloaded 69 times