LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Matlab script server to reintialize

Is there a way to reinitailize the matlab scipt server if it crashes during run-time of a labview application?
The problem is that when the matlab window is closed by the user the link is broken and the application stops working.
Is there a way to catch this error and then reload the matlab script server window/ connection during runtime so that the app
does not have to be halted, closed and reopened to reestablish the funcitonality
 
Thank for any input
 
Bryan S
0 Kudos
Message 1 of 3
(2,746 Views)

Could you package the Matlab Script Node code into a subVI and call that subVI dynamically using VI Server? The idea would be that you could poll the error output from the Matlab Script node to see if the Matlab window has been closed, thus closing the link. If it does occur, terminate the dynamic subVI and call it again from the main VI. This should completely emulate "closing and reopening the app."

Here is a link on getting started using VI Server to call VIs dynamically. The Help document references LabVIEW 8, but the process is the same for earlier versions.

Jarrod S.
National Instruments
0 Kudos
Message 2 of 3
(2,733 Views)

Here's an example of what I mean. There are two VIs, main VI.vi and Dynamic subVI.vi. Main VI calls Dynamic subVI, which should simulate your script node code, and then polls the error output of the subVI. If the subVI generates a specific error, the main VI automatically relaunches it dynamically.

The example was written in LabVIEW 7.1. Just make sure the VIs are in the same directory when running them. Hope this helps!

Jarrod S.
National Instruments
Download All
0 Kudos
Message 3 of 3
(2,731 Views)