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: 

Which are the differences between MATLAB script structure and the mathscript structure provided by the Mathscript RT module?

Hello,

 

I need to process some signals in Matlab in order to calculate some parameters. To achieve this purpose I have used the MATLAB script structure and I have put my .m code inside. Unfortunately, using this structure the program randomly crashes with the Access Violation error. I haven't find solution to this problem. So, I read that there is a LabView module that also uses Matlab: the Mathscript RT Module. I have begun to use this module and then the program don't crashes. However, I have realised that this module is very slow compared with the Matlab script structure and this is also a problem for me. 

 

Which are the main differences between the two approaches? I have realised that with the Matlab script structure, the Labview opens automatically a MATLAB Command Window. The Mathscript RT module doesn't open anything. Is the speed execution a difference between them? Am I doing anything wrong, and the speed should be the same?

 

Thank you so much.

 

 

0 Kudos
Message 1 of 3
(2,752 Views)

The MATLAB script node does exactly as you say and opens up the MATLAB dialogue.  You need MATLAB installed to get this to work and it hands off the processing to MATLAB.

 

The MathScript node uses a similar code style (not all commands are the same and not all commands can be used) but is processed entirely by LV.  You don't require MATLAB for this.  Generally speaking, you're better off using the LV equivalent code than using this node as it tends to perform better.

 

Is there any reason you're merging the two code bases together instead of writing in the one type?  Is the m code you have that extensive?

0 Kudos
Message 2 of 3
(2,740 Views)

Thank you for your reply.

 

The reason why I need to use Matlab is due to I'm working with matrixes, vectors and loops (I'm performing the LMS algorithm) in order to calculate the amplitude, frequency and phase of a digital signal that is acquired by an A/D converter. I have the LMS algorithm implemented in a Matlab file, so I'm calling this code every time I need to calculate the parameters of the signal. 

I'm also using Matlab in order to interpolate some signals and to calculate the derivative of other signals in order to find a minimum.

 

Do you think that I must to implement these functionalities in LabVIEW code? I think that the implementation of some algorithm of this style is very difficult in LabVIEW. And the process of arrays and matrixes is much simple in Matlab. 

 

Thank you again.

0 Kudos
Message 3 of 3
(2,720 Views)