Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Genetic Algorithm and Efficient Portfolio

Subject: Genetic Algorithm and Efficient Portfolio

From: Ryan

Date: 11 May, 2013 15:55:08

Message: 1 of 4

I’m watching the video here:
https://www.mathworks.com/company/events/webinars/webinarconf.html?id=30357&language=en&confirmation_page&wfsid=4551426

Very cool stuff!! When you install Matlab, and you get the ExcelLink, you have an Excel file named ‘DowPortfolio’. This file contains some macros. Here is the one that minimizes the portfolio risk:
Sub Min_Sub_Port_Risk_Click()

MLPutMatrix "targetRet", Application.Range("Summary!G18")
MLPutMatrix "portSize", Application.Range("Summary!F18")

MLEvalString ("[portStd, portRet, portWts, portIndx] = ComputeBestPortfolio(expRet,expCov,portSize,targetRet)")

MLGetVar "portWts", portWts
MLGetVar "portStd", portStd

Application.Range("Summary!D2:D31").Value = portWts
Application.Range("Summary!H18").Value = portStd

End Sub

I know VBA pretty well. I’m wondering where the logic of this is REALLY running. There must be some .m files somewhere that make this work. Can someone please tell me the name of this file, or these files? I looked for them, but I can’t find them. VBA most definitely is not doing the logic. Where is the logic really running???

Sorry if this is a dumb question. Maybe I missed something simple.

Subject: Genetic Algorithm and Efficient Portfolio

From: Phil Goddard

Date: 12 May, 2013 02:46:07

Message: 2 of 4

As per the MLEvalString command, the results are generated by the MATLAB command
[portStd, portRet, portWts, portIndx] = ComputeBestPortfolio(expRet,expCov,portSize,targetRet)

i.e. within the function ComputeBestPortfolio

Phil.

Subject: Genetic Algorithm and Efficient Portfolio

From: Ryan

Date: 18 May, 2013 14:53:08

Message: 3 of 4

"Phil Goddard" <phil@goddardconsulting.ca> wrote in message <kmmvpf$ls0$1@newscl01ah.mathworks.com>...
> As per the MLEvalString command, the results are generated by the MATLAB command
> [portStd, portRet, portWts, portIndx] = ComputeBestPortfolio(expRet,expCov,portSize,targetRet)
>
> i.e. within the function ComputeBestPortfolio
>
> Phil.


Yes!! But, I still don't really understand how it works? Is the VBA code running built-in functions in Matlab? I assume it is. I think the VBA is calling, and running, functions in Matlab, and the whole process is controlled by the ExcelLink? Is that how it works?

Thanks!!

Subject: Genetic Algorithm and Efficient Portfolio

From: Phil Goddard

Date: 19 May, 2013 14:49:16

Message: 4 of 4


> Yes!! But, I still don't really understand how it works? Is the VBA code running built-in functions in Matlab? I assume it is. I think the VBA is calling, and running, functions in Matlab, and the whole process is controlled by the ExcelLink? Is that how it works?

Yes.
Excel-Link is an Excel Add-in that can be used to start/execute/stop MATLAB.

Phil.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us