close
LabVIEW中其實也提供的一些文字撰寫方式的語法,
如Mathscript Node, Formula Node,
其中Formula Node的語法很像C,
只要在Formula Node的框邊上定義輸出(output)與輸入(output)
在框內寫下類似C的語法即可,

我寫了一個程式, 內容如下 :





相信這樣應該比較明瞭了ㄅ



Formula Node想關的語法資料:

Performing Conditional Statements Using Formula Nodes 

if (y==x && a[2][3]<a[0][1]) {

int32 temp;

temp = a[2][3];

a[2][3] = y;

y=temp;

}

else

x=y;

Performing Do Loops Using Formula Nodes 

do {

int32 temp;

temp = --a[2]+y;

y=y-1;

}

while (y!=x && a[2]>=a[0])

Performing For Loops Using Formula Nodes 

for (y=5; y<x; y*=2) {

int32 temp;

temp = --a[2]+y;

x-=temp;

}

Performing Switch Statements in Formula Nodes 

switch(month){

case 2: days = evenyear? 29: 28; break;

case 4:case 6:case9: days = 30; break;

default: days = 31; break;

}

Performing While Loops Using Formula Nodes

while (y!=x && a[2]>=a[0]) {

int32 temp;

temp = --a[2]+y;

y=y-1;

}


Precedence of Operators in Formula Nodes and Expression Nodes 

**exponentiation
+, -, !, ~, ++, and ––unary plus, unary negation, logical not, bit complement, pre- and post-increment, pre- and post-decrement

++ and –– are not available in Expression Nodes.
*, /, %multiplication, division, modulus (remainder)
+ and addition and subtraction
>> and <<arithmetic shift right and shift left
>, <, >=, and <=greater, less, greater or equal, and less or equal
!= and ==inequality and equality
&bit and
^bit exclusive or
|bit or
&&logical and
||logical or
? :conditional evaluation
= op=assignment, shortcut operate and assign

op can be +, , *, /, >>, <<, &, ^, |, %, or **.

= op= is not available in Expression Nodes.


Formula Node and Expression Node Functions

FunctionCorresponding LabVIEW FunctionDescription
abs(x)Absolute ValueReturns the absolute value of x.
acos(x)Inverse CosineComputes the inverse cosine of x in radians.
acosh(x)Inverse Hyperbolic CosineComputes the inverse hyperbolic cosine of x.
asin(x)Inverse SineComputes the inverse sine of x in radians.
asinh(x)Inverse Hyperbolic SineComputes the inverse hyperbolic sine of x.
atan(x)Inverse TangentComputes the inverse tangent of x in radians.
atan2(y,x)Inverse Tangent (2 Input)Computes the arctangent of y/x in radians.
atanh(x)Inverse Hyperbolic TangentComputes the inverse hyperbolic tangent of x.
ceil(x)Round To +InfinityRounds x to the next higher integer (smallest integer > x).
ci(x)Cosine IntegralEvaluates the cosine integral for any real nonnegative number x.
cos(x)CosineComputes the cosine of x, where x is in radians.
cosh(x)Hyperbolic CosineComputes the hyperbolic cosine of x.
cot(x)CotangentComputes the cotangent of x (1/tan(x)), where x is in radians.
csc(x)CosecantComputes the cosecant of x (1/sin(x)), where x is in radians.
exp(x)ExponentialComputes the value of e raised to the x power.
expm1(x)Exponential (Arg) – 1Computes one less than the value of e raised to the x power ((e^x) – 1).
floor(x)Round To –InfinityTruncates x to the next lower integer (largest integer <= x).
getexp(x)Mantissa & Exponent Returns the exponent of x.
gamma(x)GammaEvaluates the gamma function or incomplete gamma function for x.
getman(x)Mantissa & Exponent Returns the mantissa of x.
int(x)Round To Nearest Rounds x to the nearest integer.
intrz(x)Rounds x to the nearest integer between x and zero.
ln(x)Natural LogarithmComputes the natural logarithm of x (to the base of e).
lnp1(x)Natural Logarithm (Arg +1)Computes the natural logarithm of (x + 1).
log(x)Logarithm Base 10Computes the logarithm of x (to the base of 10).
log2(x)Logarithm Base 2Computes the logarithm of x (to the base of 2).
max(x,y)Max & MinCompares x and y and returns the larger value.
min(x,y)Max & MinCompares x and y and returns the smaller value.
mod(x,y)Quotient & RemainderComputes the remainder of x/y, when the quotient is rounded toward –Infinity.
pow(x,y)Power of XComputes x raised to the y power.
rand( )Random Number (0 – 1)Produces a floating-point number between 0 and 1 exclusively.
rem(x,y)Quotient & RemainderComputes the remainder of x/y, when the quotient is rounded to the nearest integer.
si(x)Sine IntegralEvaluates the sine integral for any real number x.
sec(x)SecantComputes the secant of x, where x is in radians (1/cos(x)).
sign(x)SignReturns 1 if x is greater than 0, returns 0 if x is equal to 0, and returns –1 if x is less than 0.
sin(x)SineComputes the sine of x, where x is in radians.
sinc(x)SincComputes the sine of x divided by x (sin(x)/x), where x is in radians.
sinh(x)Hyperbolic SineComputes the hyperbolic sine of x.
sizeOfDim(ary,di)Returns the size of the dimension di specified for the array ary.
spike(x)SpikeGenerates the spike function for any real number x.
sqrt(x)Square RootComputes the square root of x.
step(x)StepGenerates the step function for any real number x.
tan(x)TangentComputes the tangent of x, where x is in radians.
tanh(x)Hyperbolic TangentComputes the hyperbolic tangent of x.
arrow
arrow
    全站熱搜

    fishark 發表在 痞客邦 留言(1) 人氣()