NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
ChrisP
Posts: 13
0 Kudos

If statement problem in MathScript Node but not MathScript window

Is there some MathScript commands or syntax that are allowed in the script window but no in script nodes? Code which appears after and if block seems to run as expected in a script window but not a script node. 
The following code works as expected in the script window if I define p and mode and then run it. However in a script node with p and mode as inputs, the assignements that take place after the if block appear to never happen.

k=p(1);
R=p(3);
f=p(4);

if mode>0
k=1
end

J=p(2);
A=[-(k^2/R+f)/J 0; 1 0];
B=[k/J/R; 0];
C=[1 0];
D=0;

Anyone have any thoughts on what might be wrong?
Active Participant
GrantM
Posts: 371
0 Kudos

Re: If statement problem in MathScript Node but not MathScript window

Hello,

To answer your question, all commands and syntax allowed in the MathScript Window are allowed in the MathScript node.  MathScript support for the LabVIEW application builder is a new feature of LabVIEW 8.20.  If you are building an application, there are certain functions that are not supported or whose behavior changes.  For more information about these commands, search the LabVIEW help for "MathScript Functions Not Supported in the LabVIEW Run-Time Engine."

I am unable to duplicate the behavior you mention in LabVIEW 8.0 or 8.20.  Can you try creating an error out indicator from the MathScript node to see if any errors are being reported?  If there are no errors, could you post a simple VI that illustrates the behavior you are seeing?

Thanks,

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
Member
ChrisP
Posts: 13
0 Kudos

Re: If statement problem in MathScript Node but not MathScript window

I'm sorry. Apparently the problem was not the difference between the script node and the script window but the source of m input variables. It seems the ">" operator is not defined for integer data types and a quick typecast solves my problem.

Thanks anyway
By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page