VBA with Matlab using Excel Link but not Excel Builder

J

James

I need to use VBA to get Matlab calculations into Excel; I have the Excel
link but not the Excel builder for Matlab.

Many Thanks
 
J

James

Thanks for your help earlier. I now have I second problem. I need to use to
use the MatLab GARCH toolbox to ouput results to excel, the following code
dosn't error but dosn't return the results:


MLPutMatrix "A", Application.Selection
Excllink.MatlabRequest

Excllink.MLEvalString "A = garchfit(A)"
Excllink.MatlabRequest

MLGetMatrix "A", "D3"
Excllink.MatlabRequest

Thanks in advance
 
M

Mangesh Yadav

Hi James,

my experience tells me that you require the MatlabRequest only gor the
MLGetMatrix. Anyway, that apart, which oart isn't working. Is it the Put
matrix, the evalstring, or the get matrix. Debug step-by-step. Also check if
your matlab path is correct.

Mangesh
 
J

James

Thanks,

The problem is with the MLGetMatrix command. When I run the code and then
type 'A' into the MatLab command window, it returns the results as expected.
The problem is that the code dosn't output these results to Excel.

Thanks,

James
 
M

Mangesh Yadav

Hi James,

This is exactly how I use the two statements:

Call getData("A", "D3")


Sub getData(matlabVar, excelRange)
MLGetMatrix matlabVar, excelRange
matlabrequest
End Sub

With so little information won't be able to help much. Maybe you could make
a small example and try to post the code, and I could check it out on my
end.

Mangesh
 
J

James

Thanks,

Would it be possible to send you the code as an attachment?

Best Regards,

James
 
M

Mangesh Yadav

send at (e-mail address removed)
don't forget to remove the part in caps from the email id.
You could send a small matlab file and your excel file which would be easy
for me to debug. Maybe you could prepare a small example to read a value
from excel, manipulate it in matlab, and send back to excel.

Mangesh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top