LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing Values from Math Script Window to LabVIEW

Hi,
 
I want to run a VI through Mathscript Window and to pass values in and out of the VI. I know that it is not possible to pass the arguments directly from Math script Window and I cannot use Math Script node in block diagram bacause my script can change dynamically. To implement this I can use some temp file, where cript will write the values to the file and then will call the VI. VI will read the arguments from the file.
 
Is there any other easy way to implement this?
 
Also I am not able to locate "Delay" function in Math Script command list.
 
Please help on this,
 
Thanks,
Venky
0 Kudos
Message 1 of 4
(7,376 Views)
Hi Venky,

I am slightly unclear what you mean when you say you "will call the VI."  Currently, there is no mechanism for calling a VI from MathScript (from the Window, an m-file script, or the node).  Do you wish to exchange values between the MathScript Window and a VI?  If so, you do not need to use a temp file.  You can create global variables in the MathScript Window and node.  For example, to make B a global variable, type

global B;

You will need to type this command in both the MathScript window and the node.  Then, any changes to B in one place will be reflected in the other.  You mention you cannot use a MathScript node because your script can change.  You can create an output variable on the MathScript node and use it in your VI as if you just read it from the temporary file.  Also, in LabVIEW 8.20, you can use the eval command to execute a string.  If your script can change, perhaps this function would work for you.  Note, however, that this command is not available in the run-time engine (so it would not work if you wanted to build an application).

As you discovered, MathScript does not currently support a "delay" function.  Can you provide some details about the particular version of the function you are interested in?  We can then consider it for a future addition to MathScript.

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
Message 2 of 4
(7,363 Views)

Hi, Grant

"Currently, there is no mechanism for calling a VI from MathScript (from the Window, an m-file script, or the node)."

There is a function named "run" in LabVIEW 8.20. It can run a VI you specified. MathScript will wait for your VI to stop before processing next command. One weakness is that you can not specify parameter for your VI.

Smiley Wink

0 Kudos
Message 3 of 4
(7,350 Views)
Hi ttrr,

You are absolutely correct.  As you mention, one cannot pass any parameters to the VI.  We are considering adding support for calling VIs (and hence passing parameters) in a future version of LabVIEW.  In thinking of this future possibility, I completely forgot about the current ability and usefulness of simply running a VI.

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
0 Kudos
Message 4 of 4
(7,338 Views)