# MathScript Operators (MathScript RT Module)

LabVIEW 2012 MathScript RT Module Help

Edition Date: June 2012

Part Number: 373123C-01

»View Product Info Download Help (Windows Only)

The following table provides a list of the LabVIEW MathScript operators. Refer to the guidelines for MathScript syntax when using operators to write functions and scripts.

OperatorNameDescriptionExample
=AssignAssigns value to variables.a = 1
:ColonDefines ranges.a = 1:10
;SemicolonTerminates statement, does not display, or separates columns when defining a matrix.a = [1, 0]
b = [1; 2; 3]
.DotDefines the field of a structure.a(1).x = 2
a(1).y = 5
a(1).color = 'green'
~NotNegates a logical expression.a = [1, 0]
~(a)
+PlusAdds.a + b
-MinusSubtracts or negates.a - b or -a
*MultiplicationMultiplies or performs matrix multiplication on matrices.a = 2* b
/DivisionDivides or performs matrix division on matrices.a / b
.*Elementwise MultiplicationPerforms multiplication of every element of a matrix with either a scalar or every element of another matrix.a = [1 2 3; 4 5 6]
b = [2 3 5; 7 9 1]
a .* b
./Elementwise DivisionPerforms division of every element of a matrix with either a scalar or every element of another matrix.a ./ b
\Left DivisionDivides backwards.AB = Y
B = A \ Y
.\Elementwise Left DivisionPerforms backwards division of every element of a matrix with either a scalar or every element of another matrix.a .\ b
.'TranspositionTransposes a matrix.a = [1; 2; 3]
a .' b
b =
1
2
3
.^Elementwise PowerPerforms exponentiation of every element of a matrix with either a scalar or every element of another matrix.a .^ b
'Conjugate TranspositionTransposes the complex conjugate of a matrix and negates the imaginary parts. a = [-i; 1 + i; 2 - 3i]
a' = i, 1 - i, 2 + 3i
^PowerExponentiates. The result is a square matrix.A = [1 + 3i, 5.6; -2.3, 8 - i]
B = 3
A ^ B
==EqualsCompares equality. a==b
<LessLess thana < b
<=Less or EqualLess than or equal toa <= b
>GreaterGreater thana > b
>=Greater or EqualGreater than or equal toa >= b
~=Not EqualCompares inequality.a ~= b
||OrPerforms logical OR (only when both arguments are scalar). a || b
&&AndPerforms logical AND (only when both arguments are scalar).a && b
|Elementwise OrPerforms elementwise logical OR of every element of a matrix with either a scalar or every element of another matrix.a | b
&Elementwise AndPerforms elementwise logical AND of every element of a matrix with either a scalar or every element of another matrix.a & b
[]BracketDefines matrices and multiple outputs of a function.a = [1 2 3; 4 5 6]
()ParenthesesCalls functions and indexes matrices.a = (1, 2, 3)
b = a(2, 3)
{}BraceDefines and indexes cell arrays.a = {3, [7 8 9], 'hello'}
a{4} = 'bye'
a{2}

Not Helpful