LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Mannually Launch MATLAB Script Server ??

Solved!
Go to solution

Hi guys i have successfully called MATLAB code in one subVI of my Main VI. It seems once you have a subVI with MATLAB node in it, the MATLAB script server will be automatically lauched when you call the main VI.

 

But as a part of a project with hundreds of subVIs, it is not necessary to start the main VI with MATLAB each time. One reason is the launch of MATLAB takes some time, and another is not every user need MATLAB. 

 

Is that possible that we only launch the MATLAB script server when needed? Like when the user click a "Lauchn MATLAB" button, then the MATLAB script server then start to launch?

 

Thanks!

0 Kudos
Message 1 of 5
(4,601 Views)

Hello  wangyich,

 

You can include in your main VI an event structure to indicate LabVIEW when you want the Mathscript to execute. Here is a link that explains the use of these structures.

http://www.ni.com/white-paper/3331/en/

You can add a button on the front panel and make an event for that button.

 

Hope this helps.

 

Regards.

0 Kudos
Message 2 of 5
(4,534 Views)

I used an event structure and call the VI containing my MATLAB node by its reference. However, the Matlab Script Launched whenever i opened the VI ( see picture).

 

Is there another way to launch the MATLAB Script only when I click the "Initialize Matlab" button? 

 

Thanks. Capture.PNG

0 Kudos
Message 3 of 5
(4,471 Views)
Solution
Accepted by topic author wangyich

Your first reference you feed into the "vi->name" property node is allready an opened reference to the vi that contains the matlab code. Thats why matlab is loading when you open this vi.

Open the VI reference by a filepath instead, then it will work (i use this exact method in my program).

 

Edit: See the image below - it does not matter where you place this code, a event structure is not necessary. As soon as the "Open VI Reference" node is called matlab will start.

Message 4 of 5
(4,463 Views)

Thanks man!

After making this change it solved my problem!

 

Capture.PNG

0 Kudos
Message 5 of 5
(4,442 Views)