Jump to content

Calling Matlab from Labview using activex


Recommended Posts

I am new to using external code. I'm trying to use some matlab code inside labview (without using mathscript).

Downloaded several examples that use activex.

Somehow "automation Open" returns: "Error 3005 occurred at Automation Open: Object specified is not creatable in FF_Run_Matlab_Script.vi"

Code:

http://forums.lavag.org/MathScript-Matlab-...view-t8875.html

No guess about what is happenning.

WinXP SP2

Labview 8.20

Norton internet security

Matlab 2007b

Thank you very much in advance.

Link to comment

I've not coded our own Matlab tools by myself. However I checked how do we open ActiveX automation and it seems that for Automation Refnum input of Automation Open node we use constant to automation class MLApp.DIMLApp. Is this the same class you are trying to open an automation refnum for?

Tomi

Link to comment
QUOTE(Tomi Maila @ Dec 18 2007, 01:56 PM)
Yes it is the same. My intial guess was that Norton was blocking it.QUOTE(Aitor Solar @ Dec 18 2007, 02:51 PM)

What Tomi said, maybe you're using a non-creatable object. You can also generate your own COM object from Matlab to encapsulate the methods you want to use from LabVIEW.

I have not enough knowledge to do that. I'll look around trying to find an example. I'll be happy if someone can point me a good example or tutorial. TiA.

Link to comment

You probably need to update the link to the Matlab ActiveX class. I get the same error message but I don't have Matlab installed on my office PC.

Right click on the object and browse around until you find something that looks right.. and then works. It should show up in the pull down menu.

post-5791-1198074808.png?width=400

-James

Link to comment

QUOTE(Gustavo Fernandes @ Dec 19 2007, 01:25 PM)

It works well in the small project but not in the big one, looks like labview take a large amount of time processing mathscipt before running, or something else I'm missing. Also the code has many variables and parameters. I would prefer to do it keeping the matlab code I wrote before and integrating it in labview (dll, activex, etc).

I don't know if this still holds true for Labview 8x, but in Labview 7.1, there's something called a Matlab Script (under the Analyze > mathematics> formula) tools palette.

This is different from Mathscript. Mathscript, as I understand it, has Labview compiling and executing M code (or at least a subset of it). The Matlab Script launches an instance of matlab, much as I would assume you're trying to do with activex.

Link to comment
  • 2 weeks later...

QUOTE(Gary Rubin @ Dec 19 2007, 07:06 PM)

I don't know if this still holds true for Labview 8x, but in Labview 7.1, there's something called a Matlab Script (under the Analyze > mathematics> formula) tools palette.

This is different from Mathscript. Mathscript, as I understand it, has Labview compiling and executing M code (or at least a subset of it). The Matlab Script launches an instance of matlab, much as I would assume you're trying to do with activex.

I was in hollidays.

I wish everyone an happy new year 2008.

Gary, thank you very much for your reply.

I tried Mathscript but it is not what I'm looking for. I cannot copy paste my matlab code there. Too much work.

I'll try to call for NI help. I hope I can find a solution.

Link to comment

QUOTE(Gustavo Fernandes @ Jan 3 2008, 11:09 AM)

I was in hollidays.

I wish everyone an happy new year 2008.

Gary, thank you very much for your reply.

I tried Mathscript but it is not what I'm looking for. I cannot copy paste my matlab code there. Too much work.

I'll try to call for NI help. I hope I can find a solution.

Gustavo,

Do you have this example?

C:\Program Files\National Instruments\LabVIEW 7.1\examples\scriptnode\Fractal.llb\MATLAB Script - Fractal.vi

Obviously yours won't be in a LabVIEW 7.1 directory, but the same example might be there in 8.5.

If so, open this and run it.

This is the structure that I'm talking about. I think you should be able to do anything here that you can do at the Matlab command prompt or in a script, including calling other functions. Try deleting the example matlab code and running 'bench', or calling your matlab code.

I really think this is what you're looking for.

I am able to paste Matlab code into that window and run it.

Gary

Link to comment

QUOTE(Gary Rubin @ Jan 3 2008, 07:50 PM)

Thank you very much Gary.

Yes it does work. With my particular code it works well if I run it alone. If I merge it with my big applicattion matlab takes a long time to save my application and to run it the first time. Besides I would prefer to run my matlab code, so I can change the matlab code and insert it into the application without compiling the code again.

from NI

"The error 3005 can occur if you have selected a non creatable object (not

having the object, not having it registered...).

If the error occurs in development computer try this steps:

1) On the front panel, open the Controls Palette and select

Refnum»Automation Refnum.

2) Right-Click on the refnum and select ActiveX Class»Browse....

3) Select Show Creatable Items only.

4) Select it."

"How Do I Manually Register Type Libraries, ActiveX Controls, and ActiveX

Servers?

http://digital.ni.com/public.nsf/websearch...7A?OpenDocument

"

Somehow the object is creatable, I select it and got the error. I must be doing something very wrong.

Looks like I have to learn more about activex.

EDIT

Looks like I must start matlab before running mathscript for the interaction to work.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.