From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling MATLAB SOAP From MathScript

Solved!
Go to solution

Hi,

 

I have a generic question about whether it is possible to call functions that belong to non standard MATLAB from from the MathScript box. In particular, I have communication interface with a web server that utilizes Matlab's WSDL toolbox and I would like to port it pretty "as is", or with minimal changes, into the Labview module of a fellow engineer so that his instrument can send data to our centralized system, which uses SOAP as the interface.

 

I prefer not to use Labview's native SOAP modules if possible.

 

Thanks,

 

Fernando.

 

 

0 Kudos
Message 1 of 6
(3,129 Views)
Solution
Accepted by topic author FernandoGomezPancorbo

Are you actually referring to the Matlab node? MathScript is NI's version of a Matlab-like language. There is a MathScript node and a Matlab node. The Matlab node calls Matlab code using the Matlab's ActiveX Server. As such, it requires that you have Matlab installed on the computer. While MathScript is similar to Matlab, and some Matlab code can be run "as-is" within the MathScript node, there are numerous differences (especially with some of the provided functions). The differences would be in the documentation.  The MathScript node does not call Matlab code. You could, however, call a shared library from MathScript. You would need to compile your Matlab code into a shared library using the Matlab compiler. The target machine would need to have the Matlab RunTime Engine.

0 Kudos
Message 2 of 6
(3,119 Views)

Hi,

 

Thanks for the clarification. This really helps. I will try to go the shared library route and see if that works. As a follow up, if I create the shared library with another language will it work? In other words, the ability to call functions in shared libraries is specific to shared libraries created with MATLAB or any shared library. Your answer, since you reference the Matlab RunTime Engine, makes me think that it's Matlab specific, but I wanted to double check. We have the SOAP code also running on a shared library created with C# which we could also leverage.

 

Thanks for your help!

 

Fernando.

0 Kudos
Message 3 of 6
(3,110 Views)

All shared libraries require some form of run-time engine. With "regular" DLLs the run-time stuff is included with the operating system already so that's why there's (usually) nothing more required. If you create the shared library in C# then you would need to have .NET installed on the target computer. However, I don't believe that MathScript can call .NET code. Not really sure, though.

0 Kudos
Message 4 of 6
(3,106 Views)

Got it! I'll try to see if we have a license for the Matlab RunTime Engine at HP. If we do, that's most likely the route I'll take.

 

Thanks for your quick, and accurate, assistance.

 

Fernando.

0 Kudos
Message 5 of 6
(3,097 Views)

As far as I know, the Matlab RunTime does not require a license. If you go the route of a DLL for your Matlab code then you should be able to call the Matlab DLL from LabVIEW directly. However, you will need to use "simple" datatypes, as LabVIEW doesn't handle complex datatypes. There's a chapter in the LabVIEW Help on calling DLLs as well as an example. There are also several KnowledgeBase articles on this subject.

0 Kudos
Message 6 of 6
(3,082 Views)