01-07-2013 09:44 AM
Whe LabVIEW runs a Matlab code through 'Matlab Script', does the 'Matlab Script' part run in a single-thread mode or multi-thread mode? It uses the ActiveX to communicate with Matlab so I am assuming it is single-thread?
I have a LabVIEW code which has to call a .m file. I am wondering whether the program performance will be greatly improved if I convert the .m file into a .dll to eliminate the need to activate the Matlab server very time.
Solved! Go to Solution.
01-08-2013 03:33 PM - edited 01-08-2013 03:48 PM
You are correct in your supposition that the MATLAB Script nodes run single-threaded. Only one script will be able to run at a time.
You may be able to improve performance by building it into a DLL, but you'd have to test it on your machine to know by how much. I don't really thing this would be too significant. Building a code into separate DLLs may also allow you to improve performance by allowing for parallelization as you could call the separate DLLs in different threads, I believe.
Another option would be using the MathScript node - that allows for parallelization.
MATLAB® is a registered trademark of The MathWorks, Inc.
01-09-2013 08:25 AM
Thanks for the reply. That confirmed my thought that my Matlab Script is running as the single thread.
I wanted to confirm this because I was sure that the program was not using the multicores and HT technology on the CPUs. By converting to a DLL and allowing parallization, it can run all the eight CPU cores which I am sure will improve its performance.
The other option you mentioned is MathScript. I am not familiar with it. Can it also run matlab code? and allows parallization? What the difference from Matlab Script.
Thanks again.
01-09-2013
11:02 AM
- last edited on
01-28-2025
12:54 PM
by
Content Cleaner
The MathScript RT Module allows you to run your .m files within the LabVIEW environment so that it's all LabVIEW under the hood. It does not call into the MATLAB engine like the MATLAB script node does.
MATLAB® is a registered trademark of The MathWorks, Inc.