LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling functions / subroutines

Hi,

 

Can Mathscript handle functions subroutines?  In the Mathscript window I get the error message

 

"unexpected token: function"

 

 

For example:

 

function y = xx(a, b, c)

   ...

   ....

return

 

where xx is being called from the main program.

 

Thanks in advance

0 Kudos
Message 1 of 5
(7,272 Views)

Hi,

 

If you want to invoke a subroutine, the best way is to save the function as a .m script. The name of the script should be the same as your function name. Save the script in the MathScript searching path. You can set the searching path in MathScript properties. Just use Ctrl+I in MathScript Window. Then, you can invoke your subroutine in MathScript Window, such as xx(a, b, c).

0 Kudos
Message 2 of 5
(7,267 Views)

Hi,

 

Thats for the response.  It appears to be calling up the functions. 

Can I evoke m files using the Mathscript Node environment?  If so what command do I use to specify the search path?

 

Thanks in advance

 

0 Kudos
Message 3 of 5
(7,264 Views)

Hi,

 

Yes, you can invoke user-defined function in either MathScript Window or MathScript Node. You can use path or addpath to specify the search path list. Another way to specify the search path list is in LabVIEW Options. Find it at Tools->Options ...->MathScript: Search Paths.

0 Kudos
Message 4 of 5
(7,242 Views)

Hello,

 

Of the two options that ttrr presents for setting the search path, the Tools->Options dialog is much preferred. If you use this method, performance of your scripts will be much faster. Use the path and addpath functions only when you want to change the search path programatically at run-time.

 

jattas 

0 Kudos
Message 5 of 5
(7,223 Views)