Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Trying to create an ActiveX component of Matlab created with Comsol live link

Please login with a confirmed email address before reporting spam

Hello:
I need to create a link from comsol to matlab, which is not problem, but also need to connect to the running matlab application so that a third program can access it through a visual basic program automatically and repetitively run in a command line.

Attached is a docx version of a test VB program (apparently .txt and .vb files are not allowed?). In the first section I open matlab using CreateObject("Matlab.Desktop.Application") and then reaccess this using GetObject("Matlab.Desktop.Application"). This works fine. As expected it changes directory and runs the simple test.m file that creates two variables and which are listed in the matlab. All is wonderful. Note that using both CreateObject and GetObject in the same file is silly but ultimately these two will be in separate VB files.

In the second part, the comsolserver and matlab are successfully created and present in the task manager but all attempts to link to the matlab process fail. Example errors are pasted at the end of the program. In my understanding, GetActiveObject() is supposed to detect running processes that are not currently ActiveX or COM objects and connect to them retuning a handle. GetObject() apparently requires an existing ActiveX/COM object.

Any thoughts on this matter would be greatly appreciated. Perhaps this is a case of trying to sew wings on a pig but I hope not.

Peter

I am using windows 7, matlab R2011b, comsol42, MS visual studio 2010, Visual basic 2010


0 Replies Last Post 18 apr 2012, 17:14 GMT-4
COMSOL Moderator

Hello Peter Rieke

Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.

If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.