Copyright: MathConnex Help. Copyright (c) 1997 MathSoft, Inc. All rights reserved.
Citation: MathConnex Help. Copyright (c) 1997 MathSoft, Inc. All rights reserved.


Break statement

The break statement can be inserted inside of a loop to prematurely terminate the loop. The break statement can be used with the for, repeat and while statements to prevent the occurrence of an infinite loop, or if it is necessary to terminate the loop due to a specified condition.

Example

// including a break in a while loop

x = 0

while( x < 100 )

x = x +1

if (A[x] < 0.0 )

break

end

end

See also

For statement

Repeat statement

While statement


Call by reference

ConnexScript functions pass variable parameters "by reference", meaning that any changes made to the variable inside the function will affect the variable outside the function. Values can be updated inside the function, even though the placeholder variable name used inside the function may be different than the actual variable name used to invoke the function.

Example

function myfunc( x, y )

if ( x < 0 )

y = -x

else

y = x

end

myfunc = y

end

c = myfunc( a, b )

Variable b will be updated inside the function myfunc, since a reference of the variable b was passed as a parameter and not a copy of the variable b. On returning from the function myfunc, b will have the new value as set by the variable y inside the function.

See also

Returning values

Creating your own ConnexScript functions


Comments

ConnexScript supports both in-line and multiple-line comments.

In-line comments

Double forward slashes (//) begin code comments that go to the end of the line.

Example 1

//Comment

The text following the // is ignored.

Example 2

x = A[1,2;0]      // take 1st element from 2nd and 3rd row

The text following the // is ignored.

Multiple-line comments

A forward slash followed by an asterisk (/*) begins a multiple-line comment, and an asterisk followed by a forward slash (*/) ends a multiple-line comment.

Example

/* Comment line one

Comment line two

Comment line three

*/

The text inside the /* and */ is ignored.


ConnexScript contents
Break statement

Call by reference

Comments

ConnexScript language

Creating a vector or matrix

Creating indices

Creating variables

Creating your own ConnexScript functions

Data types

Efficient programming

Ending conditional statements

Environment

Expressions and operators

For statement

Function call statements

Functions

If statement

Interrogating variables

Line continuation

Multiple statements on a Line

Operators

Optional parameters

Repeat statement

Reserved words

Return values

Typographical conventions

Using ConnexScript in a Component

While statement


Creating indices

ConnexScript uses a simplified notation for indexing arrays compared to indexing in C or in a language that uses subscript notation.

ConnexScript indexes a multidimensional data set in row-major format. In row-major format, the linear order of elements proceeds from the 1st element of the 1st row through the last element of the 1st row before beginning on the 2nd row. This means row, column indexing is pointing to element positions in the matrix starting from the left element in the top row, moving from left to right, then to the first element in the next row, moving from left to right, and so forth through all the rows in the matrix.

0-based indexing

ConnexScript uses 0-based indexing. In 0-based indexing, 0 is the 1st element, 1 is the 2nd element, etc. for both row and column.

      Columns

    0   1   2   3   4

Rows	0 | 0   1   2   3   4  |

1 | 5   6   7   8   9  |

2 | 10  11  12  13  14 |

3 | 15  16  17  18  19 |

4 | 20  21  22  23  24 |

ConnexScript indexed array notation

The notation for indexing arrays is:

variable_name[ row_index1, row_index2, . . . ; column_index1, column_index2, . . . ]

where row_index and column_index can be:

expression 	(any ConnexScript expression that results in a scalar or vector)

constant	(vectors can be used in place of constants)

variable	(real scalar or real vector, ordinal values)

:	(wildcard - takes entire dimension)

and

,	(comma) - separates each index of the array

:	(colon) - indicates the entire dimension (range of elements in the row or column)

;	(semicolon) - indicates the next dimension

Examples

x = A[1,2;0]	// Take 1st element from 2nd and 3rd row,

// (Note: 0-based indexing!)

x = A[x*y]	// extract the element at position x*y

// (assuming x and y are scalar),

x = A[x;4,5]	// extract 4th and 5th column for the

// rows specified in the vector x.

B = A[:;:]	// Same as B = A, wildcard both rows and

// columns.

x = A[:]	// One-dimensional flattening turns A into a

// row vector

A note about wildcards

When wildcard notation, :, is used for indexing, ConnexScript takes the entire row or column (or both). Thus, A[3;:] will index all columns in the 4th row of the matrix A.

Similarly, A[:;5] will index all rows, taking only the 6th column.

However, using only a single wildcard without specifying the index or indices for the second dimension creates a "1-d flattening" of the matrix. Thus if A is a 2 x 3 matrix, the expression A[:] "flattens" A to become a 1 by 6 vector.

When a single wildcard is used on the left-hand side of an expression, the dimensionality of the variable is preserved, such that A[:] = 5.0 will set all the elements of the matrix A to 5.0, while preserving the original dimensions of A. By comparison, A = 5.0 will overwrite any previous value of the variable A with the single scalar value 5.0.

See also

Indexing operators

Efficient programming

Creating a vector or a matrix


Creating variables

A variable is a name, or identifier, for a location, or address, for information stored in the computer's memory.

The rules for naming variables in ConnexScript are:

must begin with an alphabetical character

may contain a combination of letters and numbers, including an underscore character (_)

the variable name cannot be the same as one of the ConnexScript reserved words

may not contain special characters that are used as ConnexScript operators

may not contain an embedded space

Examples

this_is_my_variable

t1

x_5

xyz

a1b2

See also

Creating a vector or matrix


Creating your own ConnexScript functions

When one of the ConnexScript built-in functions does not satisfy your requirements, you can write a new function in ConnexScript using the function declaration.

function funcname ( paramdef1, paramdef2, ... )

statement1

statement2

.

.

.

return

end

where each paramdef is the name of a variable passed into the function. All variables are passed by reference. The return statement is optional, and can be place anywhere inside the function in order to "return" from the function prematurely or due to some programmatic condition. Upon reaching the final end statement, the function will automatically return the variable funcname.

Return value

ConnexScript functions return their value by assignment to a variable of the same name as the function. The return statement does not take any additional arguments. For example, to return a value from the function myfunc, you would simply assign a value to the variable named myfunc inside the function body as myfunc = x + y. By default, functions have a return value of 0.0. See Returning Values for additional information.

Placeholder parameters

ConnexScript supports a language feature called function placeholder parameters. Function placeholder parameters allow users to pass as a parameter the name of a function to be used inside of another function. For example,  the user may write a generic sorting algorithm and want to pass in the function to be called when two values are compared. In this case, the sort function would be declared as:

function sort( 'compfun', array )

// sorting algorithm

for i in 1:nelem(array)

// compare two values

x = compfun( array[i], array[i-1] )

...

...

end

end

The parameter named 'compfun' is simply a placeholder for the name of a function to be defined when the function is invoked. When the function sort() is invoked, the user can now pass in the actual name of the function to be used as the comparison function. In this case, we can pass in the function name 'min' to sort in ascending order.

result = ( 'min', x )

ConnexScript will substitute the actual function named 'min' for the placeholder name 'compfun' and perform the calculations. To use the same sorting function to sort an array in descending order, you could simply pass in the function name 'max' when invoking the sort function.

Function placeholders are defined by placing the parameter name in single quotes when the function is defined and when the function is invoked. Function placeholder parameters cannot be used as optional parameters.

Optional parameters

ConnexScript supports optional parameters. Optional parameters are function parameters for which a value need not be supplied when the function is called. To declare a parameter as optional, you must provide a default value for the parameter when the function is declared. This is done using the notation ':=' (colon equal) after the parameter name.

function funcname ( nonopt_paramdef, opt_paramdef := constant_value, ... )

.

.

.

where each opt_paramdef  is the name of a variable placeholder, representing the value of either the parameter supplied to the function, or the assigned value provided by constant_value in the declaration. You can declare multiple optional parameters, but optional parameters cannot be followed by non-optional parameters.

Note: Only user-defined functions can have optional parameters.

When the function is invoked, optional parameters can either be specified positionally, or they can appear anywhere in the parameter list if the := is used and the parameter name matches the function definition. For example, if the function is declared as function myfunc(x, y:=0), then the function can be called using any of the following:

 x = myfunc(3, 5)	// optional parameter is supplied positionally

 x = myfunc(3)	// optional parameter takes default value of 0

 x = myfunc(y:=8, 2)	// using the parameter name 'y', optional assignment

// can appear anywhere in the parameter list

Example 1

function myfunc1()	// no parameters

myfunc1 = 5

end

Example 2

function myfunc2(x, y)	// declared without optionals

myfunc2 = x * y

end

z = myfunc2(4,5)

z = myfunc2(4)	// error! y is not optional!

Example 3

function myfunc3(x, y:=0)	// declared with optional y

if(y == 0)

myfunc3 = x

else

myfunc3 = x * y

end

end

z = myfunc3(4,5)	// same as above

z = myfunc3(4)	// not an error, result = 4

See also

Call by reference

Function call statements

Optional parameters

Placeholder parameters

Returning values

Environment


Creating a vector or matrix

A matrix is a rectangular array of numbers called elements.

In ConnexScript, dynamic creation of an array or matrix is done with a new statement that uses either the real or the complex keywords.

var_name = new ( real, dim1, dim2 )

In the above form of a new statement, both the real keyword and the dim2 parameter are optional.

var_name = new ( complex, dim1, dim2 )

In the above form of a new statement, the dim2 parameter is optional.

ConnexScript supports data of up to 2 dimensions in a matrix.

a single value is a scalar.

one-dimensional data is a vector which is an array of elements arranged in either one row or one column

two-dimensional data is an array of elements arranged in a matrix of rows and columns

Examples

x = new(5)	// creates a 1 by 5 row vector

y = new(5,1)	// creates a 5 by 1 column vector

z= new( real, 10, 7)	// creates a 10 by 7 real matrix

q = new( complex, 12)	// creates a complex 1 by 12 row vector

z = new( complex, 3, 5)	// creates a complex 3 by 5 matrix

ConnexScript supports creation of vectors and matrices in two ways:

static array notation

colon vector notation.

Static array notation

In a static array declaration:

curly braces '{' and '}' are used to denote the beginning and end of the static declaration

the comma ',' is used to separate values along the same row

the semicolon ';' is used to separate the next row

{ expr, expr ; expr, expr }

For example, to create a vector using static array notation, you would simply type:

x = { 1, 2, 3 }

To create a 2 by 3 matrix using static array notation you would simply type:

x = { 1, 2, 3; 4, 5, 6 }

Note: The semicolon begins the second row. When multiple rows are declared, the lengths of the vectors representing each row must be equal.

Example 1

{ 1, x, (y*z) ; z, 2.89, 4 }	// semicolon indicates new row

Example 2

x = { 1, 2, 3, 4 }	// 1-by-4 vector

A = { 1, 2, 3; 4, 5, 6 }	// 2-by-3 matrix

Example 3

y = 1:10	// 1-by-10 vector - default step 1 (see below)

z = 10:1	// automatically step -1

B = { y ; z }	// 2-by-10 array, 1st row y, 2nd row z

Colon vector notation

In a colon vector declaration, start, end, and optional step values are used to automatically generate a range of values for a vector, where the colon ':' is used to separate the expressions.

start_expr : step_expr : end_expr

For example, to create a vector spanning the values for 1 to 100, in increments of 2, you would type

x = 1:2:100

When the step value is omitted, ConnexScript defaults to a step value of 1, or, when the start value is greater than the end value, a step value of -1.

Examples

y = 1:10	// default step 1

y = 10:1	// automatically step -1

a = 1:5:1000	//1 to 1000 step 5

See also

Arithmetic natrix operators

Arithmetic array operators

Indexing operators

Creating indices


Data types

The ConnexScript language supports real and complex data, as well as Infinite (Inf) and Not-a-Number (NaN) data.

Real numbers

The array-oriented ConnexScript language uses double-precision, IEEE format floating point numbers, referred to as real numbers.

Examples

314

3.14

5.78e14	// scientific notation is supported

Complex numbers

Complex numbers consist of:

a real part, which is a real number

an imaginary part, which is stored as a real number but is equivalent to a real number*sqrt(-1)

To facilitate entering complex numbers, ConnexScript supports both the i and j notation appended to the end of numerical constants to indicate an imaginary number.

Examples

5.78i

0.5e10i

4.0 + 8.7j

Infinite and Not-a-Number

ConnexScript has built-in support for Infinite (Inf)  and Not-a-Number (NaN), which can often result from errors in calculations. Infinite and Not-a-Number values can also be assigned to variables directly, using the pre-defined variables Inf and NaN. (ConnexScript also reserves the capitalized and uncapitialized permutations of Inf and NaN, such as inf, Nan, etc.).

Examples

x = Inf

y = NaN

z = { 1, 2, NaN, 4 }


Efficient programming

Avoiding loops

Because ConnexScript is array-oriented, it is a more efficient form of programming than explicitly looping and indexing. For example, in C and Fortran in a 3x5 matrix you would need to say (in pseudo-code):

for i = 1 to 3

for j = 1 to 5

B[i][j] = A[i][j] * value;

to loop through matrix A and multiply each element by value.

In ConnexScript you could just say:

B = A * value

to automatically multiply all the elements in matrix A by value without looping.

Vectorizing your code

ConnexScript’s built-in operators and functions are optimized and designed to automatically apply an operation to the entire data set. For example, to perform an operation on every row of a matrix, with ConnexScript you can extract the row using wildcard indexing, and apply a user-defined function to update the entire row.

Example

for i in 0:(rows(A)-1)

A[i;:] = myfunc(A[i;:])

end

A more efficient approach would be to devise an algorithm that operates on the entire matrix A without indexing each row. The process of vectorization can make ConnexScript programs more efficient and improve execution time.

Tip	Use ConnexScript's built-in operators and functions whenever possible.

Avoid element-by-element indexing if maximum performance is required.

See also

Operators

Functions


Ending conditional statements

The ConnexScript end reserved word terminates for, function, if, and while statements.

See also

Creating your own ConnexScript functions

For statement

If statement

While statement

Reserved words


Environment

ConnexScript will automatically load both built-in MathConnex and ConnexScript user-written functions.

Tip	ConnexScript functions have the filename extension .MXS.

Automatic loading of built-in functions from MXSLIB directory

The built-in MathConnex functions are located in the directory

drive:\path_to_Mathcad\MXSLIB

This path information is stored in the system registry during the installation of MathConnex. The default path for the MXSLIB directory is C:\Program Files\MathSoft\Mathcad\MXSLIB.

The ConnexScript component automatically loads function files with the .MXS extension found in the MXSLIB directory.

Automatic loading of user-written functions from MXSUSER directory

The ConnexScript component can also automatically load function files with the .MXS extension found in the MXSUSER directory

drive:\path_to_Mathcad\MXSUSER

When a function called in a ConnexScript component is not found by its name as a built-in function and a .MXS file with the same name as the function exists in either the provided function library directory MXSUSER, or in the user-written function directory MXSUSER, the .MXS file will be loaded.

The default path for the MXSUSER directory is C:\Program Files\MathSoft\Mathcad\MXSUSER.

See also

Creating your own ConnexScript functions


Expressions and operators

An expression is some combination of variables, constants, operators and functions that indicates the computation of a value.

Constant expressions

Constant expressions contain only constant values:

7

7 + 8 * 19 / 3.3

Variable expressions

Variable expressions contain simple variables or simple variables and operators:

x

x + 8

x /y * 8

Indexed variable expressions

Indexed variable expressions contain vectors or array variables which are to be indexed:

x = y[5]

A[3] = B[5,3] * x

Function call expressions

Function call expressions contain function invocations, either built-in functions or user-defined functions:

y = sin(x)

r = myfunc( eig(A), A) * x

Numerical expressions

Numerical expressions contain a numerical operator:

expr + expr	matrix addition

expr - expr	matrix subtraction

expr * expr	matrix multiplication

expr .* expr	array multiplication

expr ^ expr	matrix power

expr .^ expr	array power

expr / expr	matrix right division

expr ./ expr	array division

Boolean conditional expressions

Boolean conditional expressions contain a Boolean logical or relational operator:

~ expr	logical NOT

expr xor expr	logical exclusive-OR

expr | expr	logical OR

expr & expr	logical AND

expr == expr	equality comparison

expr != expr	inequality comparison

expr < expr	less than comparison

expr <= expr	less than or equal to comparison

expr > expr	greater than comparison

expr >= expr	greater than or equal to comparison

See also

Arithmetic array operators .*  ./  .\  .^  .'

Arithmetic matrix operators  +  -  *  /  \  ^ '

Basic math functions

Indexing operators  , ;  : [ ]  { }

Logical (Boolean) operators  & |  ~  xor

Relational operators  ==  !=  >  >=  <  <=


For statement

The ConnexScript for statement is an iterative, or looping, statement.

for identifier in expr

statement1

statement2

.

.

.

end

In a for statement, a scalar value (identifier) is iterated over a range of values given in the expression (expr). Each successive iteration updates the loop value (identifier) to the next value in the expression. For example, for i in 1:10 iterates the value i over the range 1 to 10, as given by the colon vector expression 1:10.

Typically, the expression will be a colon vector of the form 1:10, or the number of elements in columns or rows of a matrix, such as 0:(rows(A)-1).

Unlike the C or FORTRAN language, the start and end range may not be sequential. For example, if x is a vector containing the elements {1, 3, 8, 23, 47}, we can use x as a source of indices into a matrix A as follows:

y = 0

for i in x

y = y + A[i]

end

Example 1

//multiply each element of A by 4

i = 0

for i in 0:99             // using for loop

     A[i] = A[i] * 4

end

Example 2

A = A * 4                 // vectorized method

Tip	The break statement can be inserted inside of a loop to prematurely terminate the loop. The break statement is often used to prevent the occurrence of an infinite loop, or if it is necessary to terminate the loop due to a specified condition.


Function call statements

ConnexScript functions have the following calling sequence:

result = funcname ( argument1,  argument2, . . . )

where result is the returned value of the function stated in funcname, argument1,  argument2 are required parameters, and the comma is required between arguments (parameters).

In ConnexScript there are two types of functions:

Built-In Functions - such as sin(x), eig(A). Built-in functions require all input parameters in order to execute.

User-Defined Functions - can be written to include optional parameters. Optional parameters, similar to C++, allow for default values to be provided for parameters not supplied in the function call.

In ConnexScript, all functions return a single value as the result, where the value can be either real or complex, scalar, vector, or matrix.

Example

y = sin( x )	// call a built-in function

y = myfunc( a, t:=b)	// call a user function

// with optional parameters

See also

Creating your own ConnexScript functions


Functions

ConnexScript contains a library of built-in functions and also supports user-written functions.

The ConnexScript built-in functions and operators are listed in the table below.

absolute value (abs)

AND logical (Boolean) operator

arc/inverse cosecant (acsc, acsch)

arc/inverse cosine (acos, acosh)

arc/inverse cotangent (acot, acoth)

arc/inverse secant (asec, asech)

arc/inverse sine (asin, asinh)

arc/inverse tangent (atan, atanh)

array multiplication

array power

array right division

braces

brackets

ceiling (ceil)

colon

columns (cols)

comma

complex conjugate (conj)

cosecant (csc)

cosine (cos)

cotangent (cot)

determinant (det)

equal to relational operator

exponential (exp)

floor

gamma function (gamma)

greater than or equal to relational operator

greater than relational operator

hyperbolic cosecant (csch)

hyperbolic cosine (cosh)

hyperbolic cotangent (coth)

hyperbolic secant (sech)

hyperbolic sine (sinh)

hyperbolic tangent (tanh)

imaginary part (im)

less than or equal to relational operator

less than relational operator

log base 10 (log10)

log base 2 (log2)

matrix addition

matrix multiplication

matrix power

matrix right division

matrix subtraction

maximum (max)

minimum (min)

natural logarithm (ln)

not equal to relational operator

NOT logical (Boolean) operator

OR logical (Boolean) operator

pi

rows

secant (sec)

semicolon

signum (sign)

sine (sin)

square root (sqrt)

tangent (tan)

time

xor logical (Boolean) operator

Example

result = acosh(x)

/* returns the arc or inverse hyberbolic cosine of x, which may be a parameter of any dimension or type. Return value is complex both for complex input and for real input outside the bounds of cosine (-1 to 1)*/

See also

Environment

Creating your own ConnexScript functions

Call by reference


If statement

The ConnexScript if statement is used with the elseif and else statements for conditional branching.

if boolean_expr

statement1

statement2

.

.

.

elseif boolean_expr

statement3

.

.

.

else

statement4

.

.

.

end

In an if statement, when the boolean_expr following the if evaluates to "true" (nonzero), the statements within the if block are executed. Otherwise, execution skips over the if block to the elseif condition (if present) or directly to the else block (if present).

The elseif block and the else block are optional.

If the elseif block is present, the statement following the elseif is executed whenever the if boolean_expr evaluates to "false" (zero) and the elseif boolean_expr evaluates to "true" (nonzero). You may have more than one elseif block.

If the else block is present, the statement following the else is executed whenever the preceding if and elseif expressions (if present) evaluate to "false" (zero).

Example

if( x > y & x != 0 )

     z = y / x

     q = log(2^z)

elseif( y >= x & y != 0 )

     z = x / y

     q = 2^z

else z = 0

     q = 1

end

See also

Boolean operators


Interrogating variables

ConnexScript has the intrinsic functions rows, cols and nelem for interrogating variables.

rows

Use the rows function to return the number of rows in a variable.

nr = rows( variable )

where nr results in number of rows in variable.

Example

nr = rows( y )	//nr results in # of rows in y

nc = cols( y )

z = new( complex, nr, nc )

cols

Use the cols function to return the number of columns in a variable.

nc = cols( variable )

where nc results in number of columns in variable.

Example

nr = rows( y )

nc = cols( y )	//nc results in # of columns in y

z = new( complex, nr, nc )

nelem

Use the nelem function to return the number of elements in a variable.

ne = nelem( variable )

Example

nr = rows( y )

nc = cols( y )

if( nelem(y) > 1)	// if total # of elements in y > 1

z = new( complex, nr, nc )

end


Line continuation

In ConnexScript, an underscore (  _ ) followed by a carriage return indicates continuation of a line of code. Example 1 shows line continuation used in a lengthy expression, and Example 2 shows line continuation used in a static array declaration, where it is often convenient to enter the values with the rows on separate lines.

Example 1

y = x^4 * r + 3*x^3 - 4*x^2 _

- x + sqrt(x*r) + acos(z)

Example 2

A = { 1, 2, 3; _

4, 5, 6; _

7, 8, 9 }	 // 3-by-3 matrix

Note: A variable name may contain a combination of letters and numbers, including an underscore character (_)


Multiple statements on a line

ConnexScript supports multiple statements on a line. The statements must be separated by a semicolon ( ; ).

statement ; statement <CR>

Examples

x = y + 5; z = x^2

x=0; for i in 0:5; x=x+i; end


Operators

+	Addition		-	Subtraction
*	Multiplication		.*	Elementwise array multiplication
^	Power		.^	Elementwise array power
/	Division		./	Array right division
&	Logical (Boolean) AND		~	Logical (Boolean) NOT
|	Logical (Boolean) OR		xor	Logical (Boolean) XOR
==	Equal to		!=	Not equal to
>	Greater than		>=	Greater than or equal to
<	Less than		<=	Less than or equal to
,	Separates each index of the array		:	Indicates entire dimension (range of elements in the row or column) of the array
;	Indicates next dimension of the array
See also

Arithmetic array operators

Arithmetic matrix operators

Logical (Boolean) operators

Relational operators


Optional parameters

ConnexScript supports optional parameters. Optional parameters are function parameters for which a value need not be supplied when the function is invoked. To declare a parameter as optional, you must provide a default value for the parameter when the function is declared. This is done using the notation ':=' (colon equal) after the parameter name.

function funcname ( nonopt_paramdef, opt_paramdef := constant_value, ... )

.

.

.

where each opt_paramdef  is the name of a variable placeholder, representing the value of either the parameter supplied to the function, or the assigned value provided by constant_value in the declaration. You can declare multiple optional parameters, but optional parameters cannot be followed by non-optional parameters.

Note: Only user-defined functions can have optional parameters.

When the function is invoked, optional parameters can either be specified positionally, or they can also appear anywhere in the parameter list if the := is used and the parameter name matches the function definition. For example, if the function is declared as function myfunc( x, y:=0), then the function can be invoked using any of the following:

 x = myfunc( 3, 5)	// optional parameter is supplied positionally

 x = myfunc( 3)	// optional parameter takes default value of 0

 x = myfunc(y:=8, 2)	// using the parameter name 'y', optional

// assignment can appear anywhere in the

// parameter list

See also

Creating your own ConnexScript functions

Function call statements


Placeholder parameters

Placeholder Parameters

ConnexScript supports a language feature called function placeholder parameters. Function placeholder parameters allow users to pass as a parameter the name of a function to be used inside of another function. For example,  the user may write a generic sorting algorithm and want to pass in the function to be called when two values are compared. In this case, the sort function would be declared as:

function sort( 'compfun', array )

// sorting algorithm

for i in 1:nelem(array)

// compare two values

x = compfun( array[i], array[i-1] )

...

...

end

end

The parameter named 'compfun' is simply a placeholder for the name of a function to be defined when the function is invoked. When the function sort() is invoked, the user can now pass in the actual name of the function to be used as the comparison function. In this case, we can pass in the function name 'min' to sort in ascending order.

result = ( 'min', x )

ConnexScript will substitute the actual function named 'min' for the placeholder name 'compfun' and perform the calculations. To use the same sorting function to sort an array in descending order, you could simply pass in the function name 'max' when invoking the sort function.

Function placeholders are defined by placing the parameter name in single quotes ( ' and ' ) when the function is defined and when the function is invoked. Function placeholder parameters cannot be used as optional parameters.

ConnexScript uses the function placeholder language feature in many of its integration and minimization functions, such as rk2, rk4, rk45, fmin, and fzero, among others. The user is encouraged to examine these VSM function files in the \VScience\vsmuser directory.

See also

Creating your own ConnexScript functions

Function call statements


Repeat statement

The ConnexScript repeat statement is a conditional looping statement that loops until the conditional expression is true. The statements are always executed at least once, until the Boolean expression can be checked. The repeat statement is similar to the while statement, except the repeat statement repeats execution of the following statements until the conditional expression evaluates to true, whereas the while statement executes the statements in the loop while the condition is true.

repeat

statement1

statement2

.

.

.

until boolean_expr

In a repeat statement, the statements following the repeat are executed over and over until the condition in the until boolean_expr clause evaluates to "true" (nonzero).

Tip	The break statement can be inserted inside of a loop to prematurely terminate the loop. The break statement is often used to prevent the occurrence of an infinite loop, or if it is necessary to terminate the loop due to a specified condition.

Example 1

// multiply each element of A by 4

i = 0

repeat 	// using repeat loop

A[i] = A[i] * 4

i = i + 1

until ( i >= nelem(A) )

Example 2

// breaking out of a repeat loop

x = 0

repeat

if ( A[x] < 0 )

break

end

x = A[x]

until ( x >= nelem(A) )

See also

For statement

While statement

Break statement

Expressions and operators


Reserved words

The ConnexScript reserved words are:

break cols  complex delete else	elseif  end error for function	if  in Inf list load	Nan  nelem new real repeat return	rows  static until while xor
Note: ConnexScript also reserves the capitalized and uncapitialized permutations of Inf and NaN, such as inf, Nan, etc.


Return values

User-written ConnexScript functions follow Pascal-style return values, where the function name represents a variable name that will hold the return value of the function.

Example

In the function named myfunc, the return value is set by simply assigning a value to the variable myfunc as:

function myfunc(x,y)

myfunc = x + y

end

If no value is specified, the return value is set to zero (0.0).

Although only one value can be returned from any function, note that input parameter values can also be directly modified since ConnexScript functions use the call by reference model for parameter passing. Thus, any input parameter could also be used to return updated values from the function if required.

See also

Call by reference

Creating your own ConnexScript functions


Typographical conventions

Reserved words

In syntax descriptions, words in bold Arial font indicate ConnexScript language-specific keywords you need to type and characters you need to type. The keywords must be typed as shown.

load, exit, real, complex [  ]  (  )  {  }

User-supplied words

In syntax descriptions, words in bold italic Times Roman font, lowercase letters show placeholders for information you are required to supply.

variable, filename, complex_number, real_number

Optional words

In syntax descriptions, words in italic Times Roman font, lowercase letters show placeholders for optional items you may supply.

variable2, expression

Code examples

Courier font is used for examples of ConnexScript code. The code you type is plain Courier font (not bolded), but results of ConnexScript code execution (answers) are shown in Bold Courier font.

y=1:5 	// code you type

// the answer is shown in bold Courier font below

y[1;5] =

    1.0000     2.0000     3.0000     4.0000     5.0000

Comments

Double forward SLASH es (//) begin code comments that go to the end of the line.

//Comment

A forward SLASH followed by an ASTERISK (/*) begins a multiple-line comment, and an ASTERISK followed by a forward SLASH (*/) ends a multiple-line comment.

/* Comment line one

Comment line two

*/

Line continuation

An underscore (  _ ) followed by a carriage return indicates continuation of a line of code.

x = y^2 + y - 5*r _

+ r^2 - 1


Using ConnexScript in a component

Multiple lines of ConnexScript instructions can be embedded in a ConnexScript component when you need user-defined computations in your system.

In a ConnexScript component, you can:

use the ConnexScript Component Editor to enter ConnexScript statements to achieve a desired function.

define up to 4 input and 4 output variables to be used in the system.

ConnexScript components are reusable

You can:

copy a ConnexScript component and paste it.

copy ConnexScript code in a ConnexScript component to the clipboard and paste it into another component.

create a module from a ConnexScript component so you can use it repeatedly in other project worksheets.

See also

Using the ConnexScript Component Editor


While statement

The ConnexScript while statement is a conditional looping statement that is executed repeatedly while a condition remains true. The while statement is similar to the repeat statement, except that in the while statement the conditional expression is checked prior to the execution of the statements inside the while block.

while expr

statement1

statement2

.

.

.

end

In a while statement, when the condition expression (expr) following the while evaluates to "true" (nonzero), the statements inside the while block are executed. After the statements contained within the while - end are executed, program control returns to the top of the while statement and the process repeats until the condition expression evaluates to "false" (zero).

Tip	The break statement can be inserted inside of a loop to prematurely terminate the loop. The break statement is often used to prevent the occurrence of an infinite loop, or if it is necessary to terminate the loop due to a user-defined condition (see Example 2).

Example 1

// multiply each element of A by 4

i = 0

while( i < 100 )            // using while loop

A[i] = A[i] * 4

i = i + 1

end

Example 2

// including a break in a while loop

x = 0

while( x < 100 )

x = x +1

if (A[x] < 0.0 )

break

end

end

See also

For statement

Repeat statement

Break statement

Expressions and operators


Static statement

In a ConnexScript component, it is often useful to have variables whose value is preserved during the entire execution of the system. The static statement can be used to set an initial condition for a variable. When the ConnexScript component is executed for the first time, initialization of the variable will occur. For example, the statement static count = 0, will initialize the variable count to 0. Each subsequent step or execution of the ConnexScript component will skip this initialization step, preserving the value of count across execution steps.

Variables declared with the static statement inside a ConnexScript component will not be reset before the next step interval in which that component is executed. All other variables are automatically deleted (reset) before the next step interval. When the system is stopped, all static variables are reset.

Example

// code inside a ConnexScript component

static count = 0

if( in0 >= 100 )

   out0 = 0

   count = count + 1

else

   out0 = in0 + 1

end

out1 = count

In this example, the output value out0 is reset to 0 if in0 reaches 100, and increments the input value otherwise. If used in a feedback loop, the value of count is preserved across execution steps of the component, and the value assigned to out1.


activate

Make an OLE object available for editing either in place or in its original application.


array

A collection of identically typed variables stored contiguously in memory.


Axum

A data analysis and technical graphing application available from MathSoft.


bitmap

Windows raster graphics image.


breakpoint

Attribute that can be applied to any component in the Worksheet so that the run will stop calculating every time the run reaches that component. Breakpoints are set through the component's context menu and remain set until you remove them in the component's context menu.


check box

A control for a setting, usually in a dialog box, that is selected when the box contains a check mark.


check

To click a check box to place a check mark in it so that it is set, as in this example:


click

Press the left (or first) mouse button, unless the right (or second) mouse button is specified.


complex data

Data consisting of both real and imaginary numbers. An imaginary number is stored as a real number, but is equivalent to some real number multiplied by the square root of –1.


Component Palettes

Palettes in the MathConnex workspace with buttons for built-in components to be dragged and dropped into the Worksheet.


component

An individual element in a system through which data passes. Components are available from the Component Palettes, or in a Project as viewed in the MathConnex Explorer.


ConnexScript component

A MathConnex component that contains a ConnexScript program. Double-clicking on a ConnexScript component opens the ConnexScript Editor where you can edit the ConnexScript program contained in the component.


ConnexScript language

The lightweight mathematical programming language used in the ConnexScript and the Conditional components. It provides basic scientific calculator functionality.


constant

A value that never changes.


context menu

A pop-up or short-cut menu displayed at the location of a selected object when the right (or second) mouse button is clicked. The menu contains commands that are contextually related to the selected object.


Glossary contents
Glossary


dockable

A property of an area of the workspace, such as the Toolbar, that allows it to be dragged away from the application window. Pressing Ctrl while dragging prevents the area from docking.


double-click

Press left (or first) mouse button twice, rapidly.


drag and drop

Press and hold the left (or first) mouse button while over an object, then move the mouse to the desired location and release the mouse button. The object, or a copy of the object, appears in the new location.


collapsed group of components

A subsystem of components hidden at a deeper level in the Worksheet and uneditable in the current Worksheet level.


collapse

To hide a subsystem or group of components at a deeper level in the Worksheet while retaining the components’ previous connections and configurations.


Explorer

Object browser in the MathConnex workspace that shows a project's contents (Project tab), available modules (Modules tab), and available components (Components tab).


export

Save internal data a single time in a different file format.


expression

Any combination of operators, numbers, and names that define the computation of a value.


fixed history

The control that defines the number of points (values) to accumulate for use in a graph before redrawing the graph with a new set of values.


function

A subroutine or procedure of ConnexScript code contained in a referenceable file. Built-in MathConnex functions reside in the MXSLIB folder. User-written functions with the .MXS filename extension can automatically be loaded into a Worksheet if they reside in the MXSUSER folder.


grab handles

Control points on a selected component used for moving, sizing, or other reshaping operations on the component.


group

A set of related controls on a dialog box page.

To drag a rectangle around multiple objects on the Worksheet to select the objects.


Glossary
A

activate

Make an OLE object available for editing either in place or in its source application.

array

A collection of identically typed variables stored contiguously in memory.

Axum

A data analysis and technical graphing application available from MathSoft.

B

bitmap

Windows bitmap image. Any bitmap can be used as the icon for a Worksheet.

breakpoint

An attribute that can be applied to any component in the Worksheet so that the run will stop calculating every time the run reaches that component. Breakpoints are set through the component's context menu. Breakpoints remain set until you remove them in the component's context menu. See also Run to this Point.

C

check

To click a check box to place a check mark in it so that it is set.

check box

A control for a setting, usually in a dialog box, which is selected when the box contains a check mark. See also check.

click

To press the left mouse button, unless the right mouse button is specified.


collapse

To hide a subsystem or group of components at a deeper level in the Worksheet while retaining the components’ previous connections and configurations.

collapsed group of components

A subsystem of components hidden at a deeper level in the Worksheet and uneditable in the current Worksheet level.

complex data

Data consisting of both real and imaginary numbers. An imaginary number is stored as a real number, but is equivalent to some real number multiplied by the square root of –1.

component

Individual “element” in a system on the Worksheet, on the Component Palettes, or in a Project as viewed in the Explorer; connects to an application or a data source.

Component Palettes

The palettes in the MathConnex workspace with buttons for built-in components.

Components tab

One of three tabs in the Explorer; shows the components available for use in MathConnex.

ConnexScript language

The lightweight mathematical programming language you use in the ConnexScript component and the Conditional component.

constant

A value that never changes.

context menu

The pop-up or short-cut menu displayed at the location of a selected object when the right mouse button is clicked. The menu contains commands that are contextually related to the selected object.

D

dockable

A property of an area of the application window that allows it to be dragged away from the application window. Pressing Ctrl while dragging prevents the area from docking.

double-click

To press the left (or first) mouse button twice, rapidly.

drag and drop

To press and hold the left (or first) mouse button while over an object, then move the mouse to the desired location and release the mouse button. The object, or a copy of the object, appears in the new location.

E

Explorer

Object browser in the MathConnex Workspace that shows a hierarchical view of a Project's contents (Project tab), available modules (Modules tab), or available components (Components tab).

export

Save internal data a single time in a different file format.

expression

Any combination of operators, numbers, and names that define the computation of a value.

F

fixed history

The control that defines the number of points (values) to accumulate for use in a graph before redrawing the graph with a new set of values.

function

A subroutine or procedure of ConnexScript code contained in a referenceable file. Built-in MathConnex functions reside in the MXSLIB folder. User-written functions with the .MXS filename extension can automatically be loaded into a Worksheet if they reside in the MXSUSER folder.

G

grab handles

Control points on a selected component used for moving, sizing, or other reshaping operations on the component.

group

A set of related controls on a dialog box page.

To drag a rectangle around multiple objects on the Worksheet to select the objects.

H

highlighted

The appearance of an object or group of objects that has been selected in order to perform an operation on the object(s). A highlighted component in the Worksheet has a gray cross-hatched border.

hot spot

An interaction area in on-line help on which the pointer changes to a hand when the mouse points to the area, and on which a double-click opens a help topic.

I

import

To bring in data a single time from a different file format and convert it into a form for calculation in MathConnex.

index

To specify row and/or column in an array. ConnexScript uses zero-based indexing.

index labels

Labels for rows and columns in the Inspector component.

input/output ports

Connecting points for wires on components. The output port is the origin of the wire. The input port is the destination of the wire. Multiple wires can be connected to an output port, but only one wire can be connected to each input port.

input/output terminals

Components automatically added to worksheets containing collapsed components for connecting input and output wires to other components.

J

K

L

leading digits

Digits before the decimal point.

loop

An iterative process that continues until a specified condition is met.

M

matrix

A two-dimensional array of values (called elements) ordered by rows and columns.

module

Preconfigured component or group of components saved in a form to be reused in other systems; also an item in the modules tab of the MathConnex Explorer.

Modules tab

One of three tabs in the MathConnex Explorer; shows the modules available for use in the project.

mouse button 1

The left mouse button on a right-handed mouse; the right mouse button on a left-handed mouse.

mouse button 2

The right mouse button on a right-handed mouse; the left mouse button on a left-handed mouse.

N

O

option buttons

A set of round button controls, usually in a dialog box, one of which must be selected:

P

parallel processing

Concurrent execution of two or more processes in a Worksheet.

pause the run

To interrupt a run by clicking the Pause button on the Toolbar.

pointer

The graphic image displayed on the screen that moves when you move the mouse.

port

See input/output port.

project

A MathConnex document (file) that contains systems designed in the Worksheet. A MathConnex project document has the filename extension .MXP.

Project tab

One of three tabs in the Explorer; shows the components in the current project.

Q

R

real data

Double-precision, IEEE-format floating point numbers.

rolling history

The control that defines the maximum number of points (values) to plot on a graph. The rolling history control drops the oldest value when a new value is calculated.

run the system

To start calculating the system by clicking the Run button.

run mode

The state of execution—running, paused, or stopped—of the system(s) in the current project.

Run to this Point

A command for applying a one-time breakpoint to a component to stop at that component the next time the system is run, but not stop during subsequent runs. See also breakpoint.

S

select

To click on an object (or click and drag a rectangle around multiple objects) in order to highlight the object(s) so that you can perform an operation on the object(s).

To click an unselected option button to highlight it so that it is set:

To click a check box to place a check mark in it so that it is set:

send

To attach a MathConnex Project to an -email message.

single step mode

Running a system one calculation at a time.

The Single Step Mode command on the Run menu controls how to step through two concurrently running systems. When single step mode is on for a run on parallel systems, MathConnex alternates through the steps in each system one at a time as each component is ready. When single step mode is off for a run on parallel systems, MathConnex moves through each system simultaneously as each component is ready.

slider

A control that displays and sets a value from a contiguous range of possible values.

step through the system

To use the Step button on the Toolbar to run the next calculation and then stop.

stop the run

To stop the calculation of a system when it is running by clicking the Stop button.

subsystem

See Collapsed Worksheet.

system

A collection of components wired together on the Worksheet. A system can be run, paused, stepped through, stopped, and saved as a project and/or as a module.

T

Toolbar

The set of buttons used to execute commands. Each button on the Toolbar is a shortcut to one of the menu commands.

trailing digits

Digits after the decimal point.

tree diagram

The hierarchical, expandable outline in the Explorer.

U

uncheck

To click a selected check box so that it becomes empty (does not display a check mark), making the check box "not set”:

unselect

To click on an unset option button (radio button) to remove the highlight from the "set" option button, making it "unset," and making the clicked button "set":

V

vector

A one-dimensional array of values.

variable

A named value that can change.

W

wire

The connection between an input port on one component and an output port of another component in a MathConnex worksheet, depicted visually as a black line. Wires define the order of calculation of components when a system is run.

Wizard

A series of dialog boxes, connected with Next and Back buttons, that guide you through a configuration task.

Worksheet

The area of the MathConnex workspace used for creating a system of wired components. You can edit, run, and analyze your system in the Worksheet.

workspace

The entire MathConnex environment, made up of the Explorer, Worksheet, Toolbar, Component Palettes, menu bar, status bar, title bar.

X

Y

Z

zoom

To change the view in the Worksheet by either moving in on successively smaller portions of the currently visible area or moving out until the entire system is displayed in the Worksheet.


highlighted

The appearance of an object or group of objects that has been selected in order to perform an operation on the object(s). A highlighted component in the Worksheet has a gray cross-hatched border.


hot spot

An interaction area in on-line help on which the pointer changes to a hand when the mouse points to the area, and on which a double-click opens a help topic.


import

To bring in data a single time from a different file format and convert it into a form for calculation in MathConnex.


index labels

Labels for rows and columns in the Inspector component.


index

To specify row and/or column in an array. ConnexScript uses zero-based indexing.


input/output ports

Connecting point for wires on components. The output port is the origin of the wire. The input port is the destination of the wire. Multiple wires can be connected to an output port, but only one wire can be connected to each input port.


input/output terminals

Components automatically added to collapsed components for connecting input and output wires to other components in the current worksheet.


leading digits

Digits before the decimal point.


loop

An iterative process that continues until a specified condition is met.


matrix

A two-dimensional array of values (called elements) ordered by rows and columns.


MB1

The left mouse button on a right-handed mouse; the right mouse button on a left-handed mouse.


MB2

The right mouse button on a right-handed mouse; the left mouse button on a left-handed mouse.


OLE

Object linking and embedding. An embedded OLE object retains the original editing and operating functionality of the application that created it. A linked OLE object will update whenever the file it is based on is updated.


option buttons

A set of round button controls, usually in a dialog box, one of which must be selected.


parallel processing

Concurrent or simultaneous execution of two or more processes in a Worksheet.


pause the run

To interrupt a run by clicking the Pause button on the Toolbar.


pointer

The graphic image displayed on the screen that moves when you move the mouse.


project

A MathConnex document (file) that contains systems designed in the Worksheet. A MathConnex project document has the filename extension .MXP.


real data

Double-precision, IEEE-format floating point numbers.


rolling history

The control that defines the maximum number of points (values) to plot on a graph. The rolling history control drops the oldest value when a new value is calculated.


run mode

The state of execution—running, paused, or stopped—of the system(s) in the current project.


run the system

To start calculating the system by clicking the Run button.


Run to this Point

A command for applying a one-time breakpoint to a component to stop at that component the next time the system is run, but not stop during subsequent runs.


select

To click on an object (or click and drag a rectangle around multiple objects) in order to highlight the object(s) so that you can perform an operation on the object(s).

To click an unselected option button to highlight it so that it is set:

To click a check box to place a check mark in it so that it is set:


send

To attach a MathConnex Project to an e-mail message.


single step mode

Run a system one calculation at a time.

The Single Step Mode command on the Run menu controls how to step through two concurrently running systems. When single step mode is on for a run on parallel systems, MathConnex alternates through the steps in each system one at a time as each component is ready. When single step mode is off for a run on parallel systems, MathConnex moves through each system simultaneously as each component is ready.


slider

A control that displays and sets a value from a contiguous range of possible values.


step through the system

To use the Step button on the Toolbar to run the next calculation and then stop.


stop the run

To stop the calculation of a system when it is running by clicking the Stop button.


system

A collection of components wired together on the Worksheet. The system can be run, paused, stepped through, stopped, and saved as a project and/or as a module.


module

Preconfigured component or group of components saved in a form to be reused in other systems; also an item in the modules tab of the MathConnex Explorer.


Toolbar

The set of buttons used to execute commands. Each button on the Toolbar is a shortcut to one of the menu commands.


trailing digits

Digits after the decimal point.


tree diagram

The hierarchical, expandable outline in the MathConnex Explorer.


uncheck

To click a selected check box so that it becomes empty (does not display a check mark), making the check box "not set":


unselect

To click on an unset option button (radio button) to remove the highlight from the "set" option button, making it "unset," and making the clicked button "set":


variable

A named value that can change.


vector

A one-dimensional array of values.


wire

The connection between an input port on one component and an output port of another component in a MathConnex worksheet, depicted visually as a black line. Wires define the order of calculation of components when a system is run.


Wizard

A series of dialog boxes, connected with Next and Back buttons, that guide you through a configuration task.


Worksheet

The graphics layout area of the MathConnex Workspace used for creating a system of wired components. You can edit, run, and analyze your system in the Worksheet.


workspace

The area of the MathConnex workspace used for creating a system of wired components. You can edit, run, and analyze your system in the Worksheet.


zoom

To change the view in the Worksheet by either moving in on successively smaller portions of the currently visible area or moving out until the entire system is displayed in the Worksheet.


Unlock subsystem

This subsystem has been locked. You must enter the password to edit or view the components in the subsystem.


Conditional component properties: Input Names

Use this dialog box to specify names for the input variable names for the Conditional component.


Conditional component properties: Output Names

Use this dialog box to specify names for the output variable names for the Conditional component.


Conditional component properties: Conditional

Enter ConnexScript language statements in each section of this dialog box.

  The ‘if’ section should contain a conditional statement. This statement is evaluated when the Conditional component receives input. An example of a valid conditional statement is in0 == -2 which states “in0 is equal to 2.”

  If the conditional statement is true, the statement(s) in the ‘then’ section are executed. An example of a valid statement for the ‘then’ section is out0=1 which states “out0 is defined to be 1.”

  If the conditional statement is false, the statement(s) in the ‘else’ section are executed. An example of a valid statement for the ‘then’ section is out0=10 which states “out0 is defined to be 10.”

Note: If you don’t want any data to be sent when a statement is true or false, you can leave the “then” or “else” sections blank. If there are no statements in the “else” section, you will not see that section when looking at the Conditional component in a system.


Excel component properties: Inputs

Use the Inputs tab of the Excel Properties dialog box to specify the cells in the Excel component which the each input will be stored. If the input is a single value, enter the cell in which it will be stored. If an input consists of more than one value, enter the starting cell for them.


Excel component properties: Outputs

Use the Outputs tab of the Excel Properties dialog box to specify the cells in the Excel component from which the each output will be extracted. For example, if you want the first output to be the values in cells A1, A2, B1, and B2 you should enter A1:B2 next to Output 1.


MATLAB component properties: Inputs

Use the Inputs tab of the MATLAB Properties dialog box to specify names for the input variable names for the MATLAB component.


MATLAB component properties: Outputs

Use the Outputs tab of the MATLAB Properties dialog box to specify names for the output variable names for the MATLAB component.


Input component properties: Display

Click on parts of the dialog to see what they’re for:


Inspector component properties: Display

Click on parts of the dialog to see what they’re for:


Inspector component properties: Accumulate

Use the Accumulate tab in the Inspector component Properties dialog to make the Inspector component store data as it flows through the component:

1. Click on the box next to Accumulate Data so that a check appears.

2. Specify the total Number of Rows of data you’d like to accumulate.

3. Specify the total Number of Columns of data you’d like to accumulate.

3. Click Accumulate by Rows if you want to each new value to be placed to the right of the previous one or on the next line. Click Accumulate by Columns if you want each new value to be placed below the previous one or in the next column.


ConnexScript component properties: Inputs

Use the Inputs tab of the ConnexScript Properties dialog box to specify names for the input variable names for the ConnexScript component.


ConnexScript component properties: Outputs

Use Outputs tab of the ConnexScript Properties dialog box to specify names for the output variable names for the ConnexScript component.


Global component properties: Variable Name
Global Variable component properties: Variable Name

To define a global variable using the Global Variable component:

1.	Enter a name for the Global Variable.

5	Make sure “This component sets the value” is checked.

5.	Click OK.

To refer to the data associated with a global variable that’s already been defined:

1.	Enter the name of the Global Variable associated with the data.

5	Make sure “This component sets the value” is NOT checked.

5.	Click OK.


File Read/Write component properties: Options

Use the Options tab of the File Read/Write component’s Properties dialog box to read in only certain rows or columns of a data file:

1. Fill in the box next to Start at Row with the number of the row containing the first value to read.

2. Fill in the box next to Start at Column with the column number containing the last value to read.

2. By default, Stop at End of Data is turned ON for both rows and columns This options makes the File Read/Write component read all the values from the starting value to the end of the file. Alternatively, click Stop at End of Data to turn it OFF and enter a value in the Stop at Row box and/or the Stop at Column box.


Scripted Object component properties: Scripting

Use the Scripting tab of the Properties dialog box to specify the number of inputs and outputs the Scripted Object component accepts and provides. You can also specify the name of the object you are scripting.

Click Edit Script to bring up the Script Editor for scripting the object.

See also

Scripting an object

Inserting the Scripted Object component

Supported scripting languages

Scripted Object component model


Ramp component properties: Scripting
Ramp component properties: Ramp

Use the Ramp tab of the Properties dialog box to specify the starting value and the increment/step value for the Ramp component. For example, enter 5 as the “starting value” and 2 as the “step value” to generate the numbers 5, 7, 9, and so on.

When you Connect the output port of the Ramp component to another component and run the system, the Ramp component generates one value at a time. The attached component will receive each value as it is produced. If one value isn’t passed further along the system or if the attached component can’t accept more than one value, the Ramp won’t generate another value.

The example below shows the Ramp component generating


Axes styles
Select the Axes style for your graph:

Box: a line appears on all four sides of the graph.

Line: a line appears on the x and y axes only.

None: no lines are displayed.

Click the “Style” button to select a line style.


Adding a module to the Worksheet

There are two methods used for adding a module to the Worksheet:

1. Double-clicking on the module immediately moves the module into the upper left corner of the Worksheet.

2. Dragging and dropping the module allows you to control the placement of the module when it is dropped into the Worksheet.

See also

Modules


Adding and removing input or output ports

Additional input and output ports can be added to the following components:

Conditional

Excel

Graph

Mathcad

ConnexScript

MATLAB

Inspector

You can also remove input and output ports from many of these components.

To add input or output ports to one of these components:

1.	Click with the right mouse button on the component in the Worksheet. The context menu appears.

2.	Select either Add Input Port or Add Output Port from the context menu. The new port appears on the component.

To remove input or output ports from one of these components:

1.	Click with the right mouse button on the component in the Worksheet. The context menu appears.

2.	Select either Remove Input Port or Remove Output Port from the context menu. The new port appears on the component.


Adding text to a MathConnex project

1.	Drag and drop a Text component into the Worksheet.

The Workspace immediately changes to show an embedded view of the OLE text component. The MathConnex Toolbar is replaced by the toolbar of the OLE text component. The OLE text component appears highlighted and contains a blinking cursor.

2.	Enter the text at the cursor.

To change the font:

A.	Click Set Font from the View menu.

B.	Enter the font, style, and size of your text.

C.	Click OK.

The text changes are made in the OLE text component.

4.	Click on an empty space outside the OLE text component. The Workspace changes back to MathConnex and the text appears embedded in the Worksheet.

5.	Click and drag the text to move it around the Worksheet.

Note: Double-clicking on the text will reopen the OLE text component so that you can edit the text.

See also

Inserting OLE objects

Text component


Axum component

The Axum component lets you create a variety of two and three-dimensional graph types.

Axum is a technical graphing and data analysis application available from MathSoft. If you have Axum 5 installed on your system, you can use the Axum component to:

Create over 75 different types of 2D and 3D graphs.

Use Axum to format every detail of a graph.

To place the Axum component onto the Worksheet:

1.	Make sure Axum 5 is installed (but not necessarily running) on your system and that your memory is sufficient.

2.	Drag and drop the Axum component icon from the Component Palettes. This launches the Axum Setup Wizard.

3.	Choose the type of graph you would like to insert and click “Next.”

4.	Choose a plot type. The available choices depend on the type of graph you selected.

5.	Click “Finish.”

An Axum graph of the type you specified is inserted into your Worksheet with an appropriate number of input ports. There are no output ports because the Axum component does not send output.

When you connect a component to the Axum component and run the system, the input data is plotted. To control the format of the graph, double-click on the Axum component to activate it.

See also

Labeling components

Resizing a component

Wiring components

Graphing using the Graph component

Viewing a component as an icon

Viewing a component as an object


When an Axum, Mathcad, Excel, or MATLAB component is active during a run or when you double-click on it, the corresponding application will run in the background. You will therefore need enough available memory to run the application and MathConnex simultaneously. It is recommended that you have at least 32 MB of RAM installed on your system.


The form of the data you pass into the Axum component depends on the kind of graph you want to create. See the Axum User’s Guide or Axum’s on-line Help to find out what form the data should be provided in for a given plot type.


Beep When Active
Beep When Active command

The Pause-Stop component is used for programmatic pausing or halting of a running system. MathConnex allows you to signal a pause or stop in your system with a beep.

To Set the Pause-Stop component to beep:

1.	Move the pointer over the Pause-Stop component and click. The context menu appears.

2.	Click Beep When Active. No visible change in the component will occur, but the next time the system is run a beep will sound when the system pauses or stops at the component.

Note: By default, the beep setting is turned off.

See also

Pause-Stop component


Breakpoints

Adding a breakpoint to your system allows you to analyze your system by examining the values at a specific point in the system rather than pausing the system at a random spot.

The Run to this Point command allows a temporary breakpoint to be added that will stop the system at the designated component only once. Clicking the Step or Run button after the temporary breakpoint has been triggered continues execution and removes the temporary breakpoint.

See also

Setting Breakpoints

Using Run to this Point


Choosing a font
Font dialog box

Clicking the Font button opens this Font dialog box. This dialog box allows you to select the Font, Font Style, and Effects for your text. When you have made your selections, click OK. The dialog box will close and your selections will be made in MathConnex.

Note: Depending on the fonts installed on your computer, more font choices may be available to you.


Custom colors
Select a color from the palette of basic colors or create your own custom colors. To define a custom color, click on the Define Custom Colors button.


Component Palettes

The Component Palettes appear on the MathConnex Workspace between the Explorer. and the Worksheet. The Component Palettes contain components which the user can drag and drop onto the Worksheet to build a system.

The dockable Component Palettes make customizing your MathConnex Workspace easy. You can move either palette to various positions on the screen as well as hiding each palette.

Palette One

	Input Inspector Graph ConnexScript Mathcad Excel Axum MATLAB®
Palette Two

	Stop/Pause Wire Breaker Initialize Conditional Ramp Text Global Variable File Read/Write
Tip	You can move the Component Palettes to a different location on the Workspace or remove them from view.

See also

Moving Component Palettes

View menu


Conditional component

The Conditional component is used to conditionally route input data.

To place the Conditional component onto the Worksheet:

1.	Drag and drop the Conditional component icon from the Component Palettes.

2.	Click on the component with the right mouse button and choose Properties from the component’s context menu.

3.	Click on the Conditional tab and fill in the “if”, “then”, and “else” sections with ConnexScript statements. Use the Input Variables and the Output Variables tabs in the Properties dialog to specify names for the inputs and outputs.

When a system containing the Conditional component runs, the Conditional component is triggered when it receives valid inputs. When it’s triggered, it determines the output, and sends it through the output port. If one of the outputs does not get defined when the component is triggered, no output is sent through its corresponding output port.

The following system is an example of how the Conditional component might be used:

See also

Labeling components

Viewing a component as an icon

Viewing a component as an object

ConnexScript component


Conditional tab

Use this tab in the Properties dialog of the Conditional component to specify what condition to check, what output to send if the condition is true, and what to send if the condition is false.

In the “If” section, enter a single-line conditional expression using a ConnexScript statement.

Some valid conditional statements include:

in0==4

in1<0

In the “Then” section, enter any number of ConnexScript statements to determine what the component will output if the conditional statement is true. Use in0, in1, etc. and out0, out1, etc. to refer to the inputs and outputs, respectively.

In the “Else” section, enter any number of ConnexScript statements determining what the component will output if the conditional statement is false. Use in0, in1, etc. and out0, out1, etc. to refer to the inputs and outputs respectively.

Note: If you don’t want any data to be sent when a statement is true or false, you can leave the “then” or “else” sections blank. If there are no statements in the “else” section, you will not see that section when looking at the Conditional component in a system.


Input component

The Input component lets you introduce data into a system.

To place the Input component onto the Worksheet:

1.	Drag and drop the Input component icon from the Component Palettes.

2.	Then insert data into the Input component by:

Typing it in manually.

Importing it from a data file.

Pasting it in from the Clipboard.

When an Input component is placed in the Worksheet, it will only output values continuously or once each time the system is run. Since it takes no input, it is commonly used as the starting point of a system.

To control the way the numbers in the Input component are displayed:

1.	Click once on the component to select it.

2.	Click on the component with the right mouse button so that you see the context menu.

3.	Choose Properties from the context menu.

4.	Click on the Display tab.

5.	Enter the settings you want and click “OK.”

See also

Data Types

Generating a series of values

Editing the Input component

Labeling components

Viewing a component as an icon

Resizing a component

Wiring components


Entering data

If you want to bring data into a system and they aren’t already stored on your computer somewhere, you can enter them manually into the Input component.

To enter data into the Input component:

1. Place the Input component on the Worksheet.

2. Double-click on the component.

3. If necessary, resize the component to see more cells.

4. Enter values into the cells.

To control the way the numbers in the Input component are displayed:

1. Click once on the component to select it.

2. Click on the component with the right mouse button so that you see the context menu.

3. Choose Properties from the context menu.

4. Click on the Display tab.

5. Enter the settings you want and click OK.


Pressing [Enter] will bring you to the next cell down. You can enter any kind of decimal or e-format number such as 3.4 or 2i or 4e-6.

If you type any imaginary or complex values, all the values in the component will be displayed as complex values. For example, if you type 4 in one cell and 6i in another cell, the values will display as 4.00 + 0.00i and 0.00 + 6.00i.


Importing data

If you want to import data from a data file into MathConnex, you can use the Input component.

To import data once from a data file:

1. Click once on the Input component with the right mouse button.

2. Choose Import from the context menu. The Read from File dialog box appears.

3. In the “Files of Type” text box, choose the type of file from which you want to import data.

4. Use the dialog box to browse to the data file and click “Open.”

5. Use the Display tab in the Properties dialog box for the Input component to control how the values are displayed in MathConnex.

To control the way the numbers in the Input component are displayed:

1. Click once on the component to select it.

2. Click on the component with the right mouse button so that you see the context menu.

3. Choose Properties from the context menu.

4. Click on the Display tab.

5. Enter the settings you want and click “OK.”

The Input component lets you import data on a one-time basis. To read data from a file continuously, use the File Read/Write component.


Pasting data in from the Clipboard

If you need to bring data into MathConnex that is stored in another application, you can save the data to a file and import it. Alternatively, you can copy the data to the Clipboard and paste it into the Input component in MathConnex.

To bring data in via the Clipboard:

1. Select the data in the other application and copy it to the Clipboard. In most applications, you do this by choosing Copy from the Edit menu.

2. Place the Input component on a MathConnex Worksheet.

3. Click on it with the right mouse button so that a context menu appears.

4. Choose Paste Data from the context menu.

To control the way the numbers in the Input component are displayed:

1. Click once on the component to select it.

2. Click on the component with the right mouse button so that you see the context menu.

3. Choose Properties from the context menu.

4. Click on the Display tab.

5. Enter the settings you want and click “OK.”


Choose or type an integer. Determines the number of values to the right of the decimal point.


Choose or type an integer n. Values smaller than 10^n are displayed as zero.


Choose or type an integer n. Values smaller than 10^-1 or greater than 10^n are displayed in exponential notation.


Click this box to display the row and column numbers associated with the values in the table.


Systems and components contents
Accumulating values

Adding a module to the Worksheet

Adding input or output ports

Adding text to a MathConnex project

Axum component

Beep When Active

Breakpoints

Collapsing part of a system

Component Palettes

Conditional component

Copying a component

Copying a graph to the Clipboard

Copying a value from the Input component

Copying an entire system to the clipboard

Creating a new project

Creating a folder

Cutting components

Cutting a value from the Input component

Data, generating a series of

Deleting a module

Deleting a module folder

Deleting components

Displaying data

Disconnecting a wire

Drag and drop components

Drag and drop modules

Editing the Input component

Embedding a project into Microsoft Word

Embedding an existing project into Microsoft Word

Entering data

Entering input variables

Entering output variables

Exporting from the Script Editor

Exporting modules

Exporting values from the Inspector

File Read/Write component

Flipping port direction

Generating a series of values

Graph component properties: Axes

Graph component properties: Labels

Graph component properties: Plot

Graphing

Graphing using Axum

Importing modules

Importing text into the Script Editor

Input component

Inserting OLE objects

Inspector component

Labeling components

Line Styles

Locking a subsystem

ConnexScript component

ConnexScript component input and output variables

MATLAB component

Initialize component

Module Properties Page

Moving a component

Moving a module within the Explorer

Moving a wire from one input port to another

Multiple wires on a single output port

Naming a module

Navigating through the Explorer

Opening an existing project

Parallel processing

Pasting components

Pausing a system

Print preview

Printing a system

Ramp component

Read from a File

Removing input and output ports

Renaming a module or component

Renaming a folder

Resizing a component

Running a system

Run to this Point

Saving a component as a module

Saving a project

Saving a system as a module

Scripted Object component

Selecting a single component

Selecting multiple components

Sending a project via email

Setting breakpoints

Setting fonts in the Script Editor

Showing labels

Stepping through a system

Stop/Pause component

Stopping a system

Text component

The Graph component

The Magnifying Glass

Undo a selection

Using Run to this Point

Using Run, Stop, Pause, and Step

Using the Script Editor

Using the Pause-Stop component

Using the Wire Breaker

Viewing input data

Viewing a component as an object

Viewing a component as an icon

Viewing a subsystem

Viewing part of a subsystem in the parent Worksheet

What is a module?

What is a MathConnex project?

Wire Breaker component

Wiring components

Write to a File

Zoom In & Zoom Out


Copying a component

To copy a component:

1.	Select a component or group of components. The selected component is highlighted.

2.	Click [image].

To paste the copied component:

1.	Click [image], select Paste from the Edit menu, or press Ctrl+V. The pasted component is inserted into the Worksheet and appears highlighted.

2.	Move the pasted component to the new location in the Worksheet.

See also

Selecting a single component

Selecting multiple components

Moving a component


Copying a graph to the Clipboard

1.	Move the pointer over the Graph component in the Worksheet. The context menu appears.

2.	Choose Copy to the Clipboard in the context menu. The graph will be copied to the Clipboard as an enhanced metafile. When you open another application that supports the enhanced metafile format (EMF), the copied graph can be pasted into that application.

Note: If you are unsure whether an application supports a given clipboard format, check to see if the Paste option for the application is enabled after you complete the Copy operation in MathConnex.

See also

Copying a component

Copying a system to the Clipboard

Graph component


Copying an entire system to the Clipboard

1.	Select the entire system.

2.	Click [image], choose Copy from the Edit menu, or press Ctrl+C. The entire system is copied to the Clipboard.

See also

Pasting components


Graph component properties: Axes

The Graph component’s Axes Properties page shown here contains the settings for the Axes Styles, Scale, Ranges, Tick Marks, and Grid Lines of your graph. Click on any hot spot for a more detailed description.

Note: Notice the Assign Settings For box between the Styles and Scale groups. All selections correspond with the highlighted axis. To set the properties for the other axis, highlight it and make your selections.


Graph component properties: Labels

The Graph component’s Labels Properties Page shown here contains the settings for Plot Labels and Data Labels. Click on any hot spot for a more detailed description.


Graph component properties: Plot

The The Graph component’s Plot Properties Page shown here contains the settings for Data History, Window Colors, and Style Settings. Click on any hot spot on this page for a more detailed description.


Creating a new project

1.	Click [image]. If a project is currently open in the Workspace, the project will be closed, and you may be prompted to save any recent changes.

See also

Opening an existing project


Creating a folder

1. Click.

2. Move the pointer over any module or component folder and click the right mouse button. The context menu appears.

3. Click New Folder in the context menu. The New Folder dialog box appears.

4. Enter the name of the new folder.

5. Click OK. The dialog box closes and the new folder appears in the tree diagram of the Explorer.

See also

Deleting a module folder

Renaming a folder

Saving a component as a module

Saving a system as a module

The Explorer


Cutting components

1.	Select a component or group of components.

2.	Click  [image] and copied to the Clipboard.

Tip 	If you should cut a component by mistake, simply select Undo from the Edit menu (or press Ctrl+Z) to put the deleted component back into the Worksheet.

See also

Undo a selection

Copying components

Pasting components


Set up your graph to show input data in a variety of ways.

None: shows the latest input data only.

Fixed: allows you to set the number of values to be plotted before the graph resets and begins plotting the next set of data.

Rolling: allows you to set the number of values to be plotted. When a new data value is generated past the length of the rolling history an old data value is removed from the front of the history.


Set up your graph to show a legend:

1.	Click the Show Legend box.

The Data Set and Data Label edit fields become active.

2.	Select the data set using the list box.

3.	Click the Font button to select the font, style, and color of your data label.

Your selection appears in the Sample box.

4.	Click OK.

The Font dialog closes.

5.	When you have made all selections on the Labels properties page, click OK.

The properties page closes and your selections are applied to the graph.


File Read/Write component

The File Read/Write component allows you to read from or write to a data file continuously.

To place the File Read/Write component on your Worksheet:

2.	Drag and drop the File Read/Write component icon from the Component Palettes. This launches the first part of the Setup Wizard.

3.	Choose “Read from data source” if you want to read in data from a file. Choose “Write to a data source” to write to a data file.

4.	Press “Next” to go to the second page of the Wizard.

5.	From the drop down list in the File Source box, choose the type of data file you want to read from or write to.

6.	Type the path to the data file or use the “Browse” button to locate it.

7.	Press “Finish.”

When you run a system containing the File Read/Write component, data will be read in from or written to the data file every time the component is triggered. When reading a file, the File Read/Write component can provide continuous output.

Note: If you are writing to a data file and there is existing data in the file, the data will be overwritten unless you specify otherwise.

See also

Reading only certain rows and columns of a file

Changing the data file being read from or written to

Viewing a component as an icon

Viewing a component as an object

Labeling components


Changing the data file being read from or created

When you use the File Read/Write component to read from or write to a file, you first specify the name and type of data file when you insert the component.

If you want to change the name or type of data file after you’ve inserted the component:

1. Click with the right mouse button on the component.

2. Select Choose File from the context menu.

3. In the “Files of Type” text box, choose a file type.

4. Use the dialog box to browse to the data file you want to specify, select it, and click “Open.”

See also

Reading only certain rows and columns of a file

Viewing a component as an icon

Viewing a component as an object

Labeling components


File reading options

To read in only certain rows or columns of a data file using the File Read/Write component:

1.	Click once on the component with the right mouse button so that you see the context menu for the component.

2.	Choose Properties from the context menu to bring up the Properties dialog box.

3.	Click on the File Options tab and specify the row and columns at which to start and stop reading.


Deleting a module

1. Click.

2. Move pointer over the desired module and click the right mouse button. The context menu appears.

3. Click Delete Module in the context menu. A dialog box appears to allow you to confirm your choice.

4. Click Yes.

The module will be removed from the tree diagram in the Explorer.

See also

Renaming a module or component

Deleting a folder

Creating a folder

Renaming a folder


Deleting a module folder
Deleting a folder

1. Click.

2. Move pointer over the desired folder and click the right mouse button. The context menu appears.

3. Click Delete in the context menu. A dialog box appears to allow you to confirm your choice.

4. Click Yes. The folder will be removed from the tree diagram in the Explorer.

Note: Deleting a folder will delete all items inside it.

See also

Deleting a module

Creating a folder

Renaming a folder

MathConnex Explorer


Deleting components

There are two methods commonly used to delete components:

Method 1: From the Worksheet

1.	Select a component or group of components.

2.	Press the Delete key on your keyboard. The selected components are removed from the Worksheet.

Method 2: From the Explorer

1.	Click the Project tab in the Explorer.

2.	Move the pointer over the component you would like to delete and click the right mouse button. The context menu appears.

3.	Select Delete from the context menu. A MathConnex dialog box appears asking if you would like to delete the component.

4.	Click Yes. The component is removed from the Worksheet and the Project tree.

Tip	If you should delete a component by mistake, simply select Undo from the Edit menu (or press Ctrl+Z) to put the deleted component back into the Worksheet.

See also

Drag and drop components

Moving a component

Undo a selection


Disconnecting a wire

1.	Move the pointer over the component's input port to which a wire is attached.

The pointer changes to [image].

2.	Click.

3.	When the pointer changes to a cross hair, release the mouse button. The wire is deleted.

The disconnected input and output ports will now have a white interior rather than a black one.

Note: Wires can be disconnected from the input port only. Trying to grab and drag the wire from the output port creates another wire.

Tip	If you should disconnect a wire by mistake, simply select Undo from the Edit menu (or press Ctrl+Z) to reconnect the wire.

See also

Wiring components


Drag and drop components

1. Click the mouse button and hold on the desired component button in the Component Palettes. The pointer becomes a [image] when you select a component from the palette.

2. Drag the pointer over to the Worksheet.

3. Release the mouse button. The selected component appears in the Worksheet.

Tip	If you should drag and drop a component by mistake, simply select Undo from the Edit menu (or press Ctrl+Z) to remove the component from the Worksheet.

See also

Deleting components

Undo a selection


Drag and drop modules

1.	Click on the Modules tab in the MathConnex Explorer.

2.	Click the mouse button and hold on the desired module in the Explorer. The pointer becomes a [image] and then changes to [image] as it crosses into the Worksheet.

3.	Drag the pointer over to the Worksheet.

4.	Release the mouse button. The selected module appears in the Worksheet.

Note: If your module is a collapsed subsystem, click on it and the module will open to show all the components inside.


Editing amnput component
Editing an Input component

Once you’ve inserted a Input component on the Worksheet and either typed data into it, imported data into it, or pasted data in from the Clipboard, you can edit the values in the component.

1.	Double-click on the component to activate it.

2.	Click on whichever cells you want to edit.

Then, to delete a row or column of cells:

1.	Click in a cell in the row or column to delete.

2.	Click on the cell with the right mouse button to display a context menu.

3.	Choose Delete Cells to bring up the Delete dialog box.

4.	Click either Entire Row or Entire Column and click “OK.”

Or, to insert a row or column of cells:

1.	Click in a cell in the row to the left of where the new row or column will be inserted.

2.	Click on the cell with the right mouse button to display a context menu.

3.	Choose Insert Cells to bring up the Insert dialog box.

4.	Click either Entire Row or Entire Column and click “OK.”

To copy or cut a value from a cell in the Input component:

1.	Select the value by drag-selecting it.

2.	Click on the cell with the right mouse button.

3.	Choose Copy or Cut from the context menu.

To paste a value to a cell:

1.	Click in a cell in the Input component.

2.	Click on the cell with the right mouse button.

3.	Choose Paste from the context menu.


Embedding a project into Microsoft Word

1.	In a Microsoft Word document, click Object from the Insert menu. The Object dialog box appears.

2.	Select MathConnex Document from the Object Type list.

3.	Click OK. MathConnex opens with a blank worksheet, and a shaded rectangle for the MathConnex Worksheet appears in Word.

4.	Create your system in the MathConnex Worksheet.

5.	When your system is completed, choose Exit on the MathConnex File menu. The MathConnex workspace closes and you are returned to Microsoft Word. Your MathConnex project appears in the Word document with a white background.

Tip	To get back into the MathConnex environment to alter your project, double-click on the MathConnex project in Microsoft Word.

See also

Embedding an existing project into Microsoft Word

Sending a project via email


Embedding an existing project into Microsoft Word

1.	In a Microsoft Word document, click Object on the Insert menu. The Object dialog box appears.

2.	Click the Create from a File tab. The Create from a File page appears.

3.	Enter file name or click Browse to find the file.

4.	Click OK. The MathConnex project that you selected will be opened and embedded into Microsoft Word.

Tip	To get back into the MathConnex environment to alter your project, double-click on the project in Microsoft Word.

See also

Embedding a project into Microsoft Word

Sending a project via email


Entering input variables

Note: Follow these steps when entering ConnexScript or MATLAB input variables.

1.	Move the pointer over the ConnexScript or MATLAB component in the Worksheet and click. The context menu appears.

2.	Click Properties in the context menu. The Properties dialog box appears.

3.	Click on the tab labeled Input Variables. The Input Variables page appears.

4.	Enter a new variable name.

5.	Click OK. The Properties page closes.

See also

Entering output variables

Naming Variables

ConnexScript language

Using ConnexScript in a component


Entering output variables

Note: Follow these steps when entering ConnexScript or MATLAB output variables.

1.	Move the pointer over the ConnexScript or MATLAB component in the Worksheet and click. The context menu appears.

2.	Click Properties in the context menu. The Properties dialog box appears.

3.	Click on the tab labeled Output Variables. The Output Variables page appears.

4.	Enter a new variable name.

5.	Click OK. The Properties dialog box closes.

See also

Entering input variables

Naming variables

ConnexScript language

Using ConnexScript in a component


Excel component

MathConnex supports a direct link to a Microsoft Excel worksheet for passing numerical data between the MathConnex environment and an Excel worksheet.

When using the Excel component, you can:

Pass one or more inputs to an Excel worksheet, manipulate the inputs, and provide outputs.

Use an Excel worksheet as a data source for passing data into the MathConnex environment and have the option for continuous output.

Display the component as an icon to hide large worksheets.

To place the Excel component onto the Worksheet:

1.	Make sure Excel 7.0 or higher is installed (but not necessarily running) on your system.

2.	Drag and drop the Excel component icon from the Component Palettes. This launches the Excel Setup Wizard.

3.	If you want to connect to an existing Excel file, choose “Create from file,” and type the path name in the text box or use the Browse button to locate the file; then click “Open.” If you don’t want to connect to a previously created file, choose “Create an empty Excel worksheet.”

4.	Click the Display as Icon box if you want to display the Excel component as an icon in the Worksheet rather than as a view onto a Excel worksheet.

5.	Click on the “Next” button. The Wizard brings you to the next page.

6.	Specify the number of inputs and outputs.

7.	Specify the Input ranges: specify the Excel cells in which the values of each input will be stored. Enter the starting cell.

8.	Specify the Output ranges: the Excel cells whose values will be sent as output. For example, enter C2:L11 to output the values in cells C2 through L11.

9.	Click “Finish.” You’ll see the Excel component in your Worksheet with the appropriate number of input and output ports.

If you chose to create a new worksheet, you’ll need to edit the Excel worksheet.

The example below shows how you can send data from an Excel component to a Mathcad component, manipulate it in Mathcad, and retrieve the results.

See also

Specifying cells for input

Specifying cells for output

Editing an Excel component

Adding and removing input or output ports

Labeling components

Resizing a component

Viewing a component as an icon

Viewing a component as an object

Wiring components


Continuous Output

1.	Move the pointer over the component in the Worksheet and click the right mouse button. The context menu appears.

2.	Choose Continuous Output in the context menu.

When Continuous Output is checked, the component repeatedly sends the same value whenever the output port is clear.


View as Icon

1.	Move the pointer over the component in the Worksheet. The context menu appears.

2.	Choose View / As Icon from the context menu.

The component appears as an icon in the worksheet when As Icon is checked.


Specifying input for an Excel component

Once you set up an Excel component, you may find that you want to change the cell ranges for inputs which you initially specified in the Setup Wizard. To do so

1.	Move the pointer over the Excel in the Worksheet and click the right mouse button. The context menu appears.

2.	Choose Properties from the context menu. The Properties dialog box appears.

3.	Click on the Inputs tab. The Inputs page appears.

4.	Enter the name of the starting cell for the input data.

When wired with an input port, the collected input will be placed in the cells beginning with the starting cell.

When no input port is wired to an Excel component, the data in the cells beginning with the starting cell will be used as source data.

5.	Click OK. The Properties page closes.

See also

Specifying output for an Excel component


Starting Cell

The starting cell corresponds to the upper left corner where data will be placed. For example, if a 10x10 matrix is being taken as input and the starting cell is C2, the data will be inserted into the range C2:L11.


Specifying output for an Excel component

Once you set up an Excel component, you may find that you want to change the cell ranges for outputs which you initially specified in the Setup Wizard. To do so

1.	Move the pointer over the Excel in the Worksheet and click the right mouse button. The context menu appears.

2.	Choose Properties from the context menu. The Properties dialog box appears.

3.	Click on the tab labeled Outputs. The Outputs page appears.

4.	Enter a range of cells from which output data will be retrieved. For example, enter C2:L11 to extract a 10x10 matrix of real values.

5.	Click OK. The Properties page closes.

See also

Specifying input for an Excel component


Editing an Excel component

1.	Double-click.

The Excel component opens showing the Excel worksheet contained in the component. The menus and toolbars change to Excel menus and toolbars.

(If the Excel component is displayed as an icon, a separate Excel window will open when you double-click.)

2.	Edit the worksheet.

See also

Specifying input for an Excel component

Specifying output for an Excel component

Adding and removing input or output ports


Exporting from the Script Editor

You can export the statements contained in the Script Editor to several types of files:

*.mxs	ConnexScript files
*.txt	ASCII text file
To export statements contained in the Script Editor:

1.	Double-click. The Script Editor opens showing the statements contained in the component.

2.	Select Export from the File menu. The Export dialog appears.

3.	Specify the path and filename of the target file.

4.	Select the desired file type.

5.	Click Save. The entire contents of the Script Editor is exported to the target file.

See also

Importing Text into the Script Editor


Exporting modules

MathConnex allows you to export user created modules to a directory so that you can share them with other MathConnex users.

To Export a module:

1.	Click on the module listed in the MathConnex Explorer. The Modules tree diagram appears in the Explorer.

2.	Select a module from the tree diagram and click the right mouse button. The context menu appears.

3.	Click Export in the context menu. The Save As dialog box appears.

4.	Enter the directory in the Save In box.

5.	Enter the filename.

6.	Click Save. The module will be exported to that directory so that it can be imported by another user later.

See also

Importing a module

Modules


MathConnex allows you to select the file format.

You have three options:

MathConnex: a custom file format optimized for use within MathConnex. This format supports storing multiple real and complex scalars, vectors, and matrices.

MATLAB MAT file: MATLAB custom file format. This format supports storing multiple real and complex values. If you are using MATLAB 5, save your MAT file in version 4 format using the -v4 switch. See the MATLAB documentation for details.

ASCII, delimited: plain ASCII text files, with numerical values printing in scientific notation, and delimited by either a comma, a tab, or a space.


Flipping port direction

You can change the port direction for any component in your system. Changing the port direction reverses the positions of the input and output ports. Reversing the port directions can reduce the diagram's complexity by shortening the wire paths between connected components.

To flip the port direction:

1.	Move the pointer over the component and click. The context menu appears.

2.	Select Flip Port Direction in the context menu. The input and output ports on the component will change direction.

Note: This menu item "toggles" the port direction. Selecting it again will flip the ports back to their original direction.


Set the grid lines for each axis of your graph.

Major Grid Lines: specify how many major grid lines to display on the graph..

Minor Grid Lines: specify how many minor grid lines to display on the graph.

To set the grid lines:

1.	Select the axis in the Assign Settings For: field.

2.	Select Major Grid.

A check appears in the box.

3.	Click the Style button to select a line style.

4.	Click OK.

5.	Repeat for Minor Grid.

6.	Select the other axis in the Assign Settings For: field.

7.	Repeat the steps.

8.	When you have made your selections, click OK.

The Axes Properties page closes and your selections are applied to the graph.


Global Variable component

Use a Global Variable component when several components need to access a particular value.

If you want to send a single output to several different components, you can connect the one component to several different components or use the Global Variable component which lets you give a name to the output from a component and refer to it without having to make a connection to the component producing it.

To place the Global Variable component onto the Worksheet:

1.	Drag and drop the Global Variable component icon from the Component Palettes.

2.	Click on the component with the right mouse button and choose Properties from the context menu.

3.	Click the Variable Name tab to indicate the variable to create or use.

When a Global Variable component receives values as input, all other Global Variable components with the same variable name send those values as output. To see this behavior, choose Highlight Components from the Run menu and press the Step button on the toolbar repeatedly.

The example below shows how one instance of a Global Variable gives a name to some output, and other instances refer to that output.

See also

Defining or using a Global Variable

Editing a Global Variablecomponent

Viewing a component as an icon

Viewing a component as an object

Labeling components

Wiring components

Resizing a component


Defining and using a global variable
Defining or using a global variable

To define a global variable using the Global Variable component:

1.	Choose Properties from the component’s the context menu.

2.	Click on the Variable Name tab.

4.	Enter a name for the Global Variable.

5	Make sure “This component sets the value” is checked.

5.	Click OK. The Properties page closes.

6.	Connect the output port from the component generating the data to tag to the input port of the Global Variable.

When the system runs, the data going into the Global Variable will be tagged with the name you specified.

To refer to that data with its name via the Global Variable component:

1.	Place a Global Variable componentglobal_variable on the Worksheet. By default, it will have the same variable name as the one you created previously.

2.	Connect the output port from the Global Variable component to any other component.

To create a new Global Variable, follow the steps above, but replace the name in the Variable Name tab with a new name and click to place a check mark in the box next to “This component sets the value.”

See also

Editing a Global Variable component


Editing a Global Variable component

To use a different global variable or create a new one

1.	Double-click on the Global Variable component.

2.	Change the variable name or turn “This component sets the value” on so that you are creating a new global variable.

See also

Defining or using a global variable


Importing modules

MathConnex allows you to import a copy of another user's module into your own Workspace.

To import a module from another MathConnex user:

1.	Click. The Modules tree diagram appears in the Explorer.

2.	Move the pointer over a modules folder in the tree diagram and click the right mouse button. The context menu appears.

3.	Click Import in the context menu. The Open dialog box appears.

4.	Enter the filename of the module you wish to import in the Look In box.

5.	Click Open. The Import Module dialog box opens.

6.	Name the module. You do not have to rename the module.

7.	Click OK. The imported module appears in the Modules tree diagram.

See also

Exporting modules


Importing text into the Script Editor

You can import code from other files into the Script Editor. The source file types recognized are:

ConnexScript(*.mxs)

MATLAB (*.m)

ASCII Text (*.txt)

To import the contents of another file:

1.	Position the cursor at the line where you want to import code from a file.

2.	Select Import from the File menu. The Import dialog appears.

3.	Navigate to the file you want to import.

4.	Click Open. The contents of the file is added to the Script Editor text at the position the cursor was in when the import command was invoked.

5.	Edit the imported text if necessary.

6.	Select Apply Changes from the File menu, click the [image] button, or press Ctrl+S. The changes are checked for correct syntax. If an error is discovered, an error message appears.

See also

Exporting from the Script Editor

ConnexScript language

Scripted Object component

MATLAB component


Inserting OLE objects

Any application on your system that supports OLE can be inserted into any MathConnex project you create. You can find out which applications support OLE embedding by choosing Object from the MathConnex Insert menu. The dialog box that appears shows you the insertable OLE objects in your system.

To insert an OLE object into your MathConnex project:

1. Select Object from the MathConnex Insert menu. The Insert Object dialog box appears.

2. Select the object type from the list.

3. Click OK. The application you selected opens.

4. Complete the task in the application.

5. Click Exit. It is inserted into the MathConnex Worksheet.

To insert an existing object:

1. Select Object from the Insert menu. The Insert Object dialog box appears.

2. Click the Create from File button. The Insert Object dialog box changes.

3. Enter the file name or click Browse to view files.

4. Click OK. The selected object is inserted into the MathConnex Worksheet.


Inspector component

The Inspector component displays the value of data on a wire in a spreadsheet format.

To place the Inspector component onto the Worksheet:

1. Drag and drop the Inspector component icon from the Component Palettes.

2. Connect the output port of another component to the input port of the Inspector.

When you run the system, the Inspector component displays the input and sends the data back out into the system unchanged.

Double-clicking will produce scroll bars which allow you to scroll through the Inspector more easily when viewing a large matrix.

You can also use the Inspector to:

Export the data being displayed.

Accumulate data as it flows through a system.

To control the way the numbers in the Inspector component are displayed:

1. Click on the component with the right mouse button so that you see the context menu.

3. Choose Properties from the context menu.

4. Click on the Display tab.

5. Enter the settings you want and click “OK.”

See also

Adding and removing input or output ports

Labeling components

Resizing a component

Viewing a component as an icon

Viewing a component as an object


Exporting from Inspector component
Exporting data from the Inspector component

If you are displaying data in the Inspector component, you can export the values to a data file.

To do so:

1. Click once on the Inspector component with the right mouse button.

2. Choose Export from the context menu. The Write to File dialog box appears.

3. In the “Files of Type” text box, choose the type of file you want to create.

4. Use the dialog box to browse to the data file and click “Open.”

The Inspector component lets you export data on a one-time basis. To write data to a file continuously, use the File Read/Write component.


Accumulating data with Inspector component
Accumulating data using the Inspector component

The Inspector is also useful for storing data as it flows through the system. For example, you might want to run a system 15 times, capturing a value from each run. Then, once you’ve gathered 15 values, you want to send them further along the system. To gather values this way:

1. Click on the Inspector component with the right mouse button.

2. Choose Properties from the context menu.

3. Click on the Accumulate tab.

4. Click on the box next to Accumulate Data so that a check appears.

5. Specify the total number of rows and columns of data values you’d like to accumulate and whether the values should accumulate row by row or column by column.

When the Inspector is configured to accumulate data, it will have one input port and one output port. It accumulates the number of values you specified in terms of rows and columns and then sends the values along the wire connected to the output port.


Data file types
MathConnex lets you import from and export to the following types of files:

Formatted Text (*.prn)

Tab Delimited Text (*.dat, *.txt)

Comma Separated Values (*.csv)

MATLAB Data/Environment Files (*.mat)

Excel Files (*.xls)

Lotus 1-2-3 Files (*.wks, *.wk1, *.wk*)

Quattro Pro Files (*.wq?, *.wb?)

dbase III Files (*.dbf)

S-Plus Files


Define the styles of a line:

1.	Click the Style button.

The Line Style dialog box appears.

2.	Select Line Type and Color using the arrows.

A sample of your selection appears.

3.	Click OK.

The Line Style dialog box closes.

4.	When you have made all selections on the Plot Properties page, click OK.

The Properties page closes and your selections are applied to the graph.


Labeling components

1.	Click with the right mouse button on the component in the Worksheet. The context menu appears.

2.	Click Properties in the context menu. The Properties dialog box appears.

3.	Enter the component label and description on the General page. The component description field does not have to be filled in, but this field gives the end-user an opportunity to view any supplemental text that describes the purpose of the component.

4.	Click OK. The Properties dialog box closes. The component name appears in the project view of the Explorer.

Note: The component label will also display on the MathConnex Worksheet if Show Labels on the MathConnex View menu has a check next to it.

See also

Component Palettes

Showing labels


Line styles

The Line Type box contains line choices. When you select a line it will appear in the Sample box.

The Color box contains color choices. When you select a color the line in the Sample box will change to reflect the new color choice.

To define the styles of a line:

1.	Click the Style button. The Line Style dialog box appears.

2.	Select Line Type and Color using the arrows. A sample of your selection appears.

3.	Click OK. The Line Style dialog box closes.

4.	When you have made all selections on the Plot Properties page, click OK. The Properties page closes and your selections are applied to the graph.


Mathcad component

MathConnex supports a direct link to a Mathcad PLUS worksheet for passing numerical data between the MathConnex environment and a Mathcad worksheet.

Using the Mathcad component, you can:

Pass one or more inputs to a Mathcad worksheet, manipulate the inputs, and provide outputs.

Use a Mathcad worksheet as a data source for passing outputs into the MathConnex environment and have the option for continuous output.

Display the component as an icon to hide large worksheets.

To place the Mathcad component onto the Worksheet:

1.	Drag and drop the Mathcad component icon from the Component Palettes. This launches the Mathcad Setup Wizard.

2.	If you want to connect to an existing Mathcad file, choose “Create from file,” and type the path name in the text box or use the Browse button to locate the file; then click “Open.” If you don’t want to connect to a previously created file, choose “Create an empty Mathcad worksheet.”

3.	Click the Display as Icon box if you want to display the Mathcad component as an icon in the Worksheet rather than as a viewpoint on a Mathcad worksheet.

4.	Click on the “Next” button. The Wizard brings you to the next page.

5.	Specify the number of inputs and outputs.

6.	Click “Finish.” You’ll see the Mathcad component in your Worksheet with the appropriate number of input and output ports.

If you chose to create a new worksheet, you’ll need to edit the Mathcad worksheet.

When you Connect the Mathcad component into a MathConnex system and run the system, the input data flows into the Mathcad component worksheet and are assigned to the Mathcad variables in0, in1, etc. The values in out0, out1, etc. will flow out of the component.

The example below shows how you can send data from an Excel component to a Mathcad component, manipulate it in Mathcad, and retrieve the results.

See also

Editing a Mathcad component

Defining input and output variables

Adding and removing input or output ports

Labeling components

Resizing a component

Viewing a component as an icon

Viewing a component as an object

Wiring components


Defining input and output variables in the Mathcad component
Defining input and output variables in a Mathcad component

Input variables:

When a Mathcad component is wired with an input port, the input variables are assumed to have the names in0, in1, etc. Refer to these variables in your Mathcad worksheet.

Output variables:

To send any values from a Mathcad worksheet as output, define output variables in terms of them. The output variables must have the names out0, out1, etc. Define them just as you would define any variable in Mathcad:

Type a variable name (out0, out1, etc).

Type “:” to create := with a placeholder

Type a number, expression, or array.

See also

Editing a Mathcad component

Adding and removing input or output ports


Editing a Mathcad component

1.	Double-click.

The Mathcad component opens. The menus and toolbars change to Mathcad’s menus and toolbars.

(If the Mathcad component is displayed as an icon, a separate Mathcad window will open when you double-click.)

2.	Type in the Mathcad component worksheet just as you would in a regular Mathcad worksheet: enter equations, define functions, create graphs, etc.

Use the variable names in0, in1, etc. to refer to the inputs. Each input can be a scalar, vector, or matrix. Define variables out0, out1, etc. if there will be output from the component. The values of these variables will be sent out of the Mathcad component to the next component in the system.

See also

Defining Input and output variables

Adding and removing input or output ports

Labeling components

Resizing a component

Wiring components


MATLAB component

MathConnex supports a direct link to the MATLAB environment from The MathWorks.

MATLAB is a technical computing environment for numeric computation and visualization. To use the MATLAB component you must have MATLAB software installed (though not necessarily running).

When using the MATLAB component, you can:

Manipulate data using the Editor to enter MATLAB statements.

Define up to 4 input and 4 output variables to be used in the system.

Use a MATLAB worksheet as a data source for passing data into the MathConnex environment and have the option for continuous output.

Display graphical output directly on the Worksheet as a result of graphic commands executed by MATLAB as the system runs.

To place the MATLAB component onto the Worksheet:

1.	Make sure MATLAB Professional version 4.2c or higher or MATLAB Student Edition version 5 or higher is installed (but not necessarily running) on your system.

2.	Drag and drop the MATLAB component icon from the Component Palettes. The MATLAB component will appear in your Worksheet. By default, it has one input port

3.	Edit the MATLAB file.

NOTES FOR MATLAB USERS

MathConnex currently supports The MathWorks, Inc., MATLAB for Windows version 4.2c or higher using the MATLAB component on the Component Palettes. The MATLAB 4.0 Student Edition will also function in a limited manner, but is not supported. You must have a licensed copy of MATLAB installed on your computer to use the MATLAB component.

The MATLAB component uses the Dynamic Data Exchange (DDE) capabilities of MATLAB to transfer instructions to MATLAB for computations, and from MATLAB for numerical results and graphics (data output and display); for graphics rendering from MATLAB version 5, the MATLAB component uses the Windows Clipboard instead. DDE is not a fast interface since information must be transferred across application boundaries, so performance may not be as fast as with the built-in ConnexScript component and language, or when MATLAB is used standalone.

The MathConnex environment allows you to pass only scalars, vectors, or two-dimensional arrays to and from MATLAB via the MATLAB component. You may not pass more advanced data types, such as multidimensional arrays supported in MATLAB 5; you may, however, perform any computations and use any data types within MATLAB that are supported by that environment, provided that you observe this restriction on inputs and outputs.

One efficient use of the MATLAB component is to augment the built-in ConnexScript and Graph components with MATLAB functions involving complex calculations and/or graphics display. The MATLAB component is not recommended for quick calculations where maximum performance is required.

When you place a MATLAB component on the Worksheet in MathConnex, the first MATLAB component will attempt to locate and launch the MATLAB application. If this should fail for any reason, you can also start MATLAB outside of MathConnex to shortcut any problems with locating the MATLAB executable, starting MATLAB, or establishing a DDE connection.

Running a MATLAB component within MathConnex resets the MATLAB environment. Be sure to save any work in MATLAB before you run a MathConnex system containing a MATLAB component.

See also

Adding and removing input or output ports

Labeling components

Resizing a component

Viewing a component as an object

Wiring components


Editing a MATLAB component

To edit a MATLAB component:

1.	Double-click the MATLAB component in the Worksheet. The MATLAB component opens as a text editing window.

2.	Type in the MATLAB component worksheet just as you would in a regular MATLAB file. Use the variable names in0, in1, etc. to refer to the inputs. Each input can be a scalar, vector, or matrix. If there will be output from the component, define variables out0, out1, etc. The values of these variables will be sent out of the MATLAB component to the next component in the system.

3.	Choose Apply changes from the File menu or click on the button.

4.	Choose Close & Return from the File menu, or press Esc.

When you Connect the MATLAB component into a system and run the system, the input data will flow into the MATLAB component worksheet as in0, in1, etc. The values in out0, out1, etc. will flow out of the component. To use names other than these, click on the component with the right mouse button and choose Properties from its context menu. Select the Input Variables tab to change the input names. Select the Output Variables tab to change the Output names.


ConnexScript component input and output variables

You can rename the input and output variables in the ConnexScript component's Properties dialog box. The default variable names for the four input/output ports are given in the following table.

Input Port	Default Variable Name		Output Port	Default Variable Name
Input 1 Input 2 Input 3 Input 4	in0 in1 in2 in3		Output 1 Output 2 Output 3 Output 4	out0 out1 out2 out3
Example

To define the input to input port 1 and the output from output port 1 in a ConnexScript component, you could type the following in the ConnexScript Editor:

x=in0

x=x+9

out0=x

or

vars=in0[0];

y=in0[1];

x=in0[vars+1];

out0={x;y}


ConnexScript component

ConnexScript is a lightweight matrix calculation language you can use for mathematical computation when you don’t need the full functionality of Mathcad, Excel, or MATLAB.

To use the ConnexScript component in a system:

1.	Drag and drop the ConnexScript component icon from the Component Palettes. The ConnexScript component will appear in your Worksheet.

2.	Use the Editor to enter ConnexScript statements to manipulate the input variables and define output variables.

See also

Adding and removing input or output ports

Calling a function

Entering input variables

Entering output variables

Functions

Labeling components

Viewing a component as an object

ConnexScript language

Using the ConnexScript Editor


Initialize component

The Initialize component accepts data from one input port the first time you run a system and from another input port during subsequent runs. This allows you to provide an initial condition to a system.

To place the Initialize component onto the Worksheet:

1.	Drag and drop the Initialize component icon from the Component Palettes. The Initialize component will appear in your Worksheet with two input ports

2.	Connect the output ports of the Initialize component.

When you run the system for the first time, data flows into the Initialize component through the upper input port and out the output port. When the data flows into the component any other times, it flows through the lower input port and out the output port.

Note: The Initialize component doesn’t change the input in anyway. It simply directs the input back into the system.

The figure below show how the Initialize component lets you specify an initial value for a system.

See also

Labeling components

Viewing a component as an object

Wiring components

Resizing a component


Moving a component

1.	Select a component or group of components.

2.	Move the pointer over one of the selected components.

3.	Click while moving the pointer to the component's new position. A hatched outline of the selected component will move with the pointer to the new position.

4.	Release the mouse button. The component is in the new position.

Tip	To immediately return the component back to its original position, select Undo from the Edit menu (or press Ctrl+Z).

Selecting Redo from the Edit menu (or pressing Ctrl+A) will return the component previous position.

See also

Deleting a component

Drag and drop components

Undo a selection


Moving a module within the Explorer

1.	Click on the module name within the Explorer. The module name highlights.

2.	Drag the name over to the Worksheet. As you begin to drag it, the pointer changes to a [image]. Continue dragging until the pointer changes to [image] and drop it in the desired location in the Worksheet. When you release the mouse button, the module appears in its new position in the tree diagram.

See also

Deleting a module

Deleting a folder

Renaming a folder

Renaming a module or component


Moving a wire from one input port to another

1.	Move the pointer over a component's input port at which a wire is attached. The pointer will change to [image].

2.	Click while moving the hand to the new input port. The wire appears as you move the hand.

3.	Release the mouse button when the crosshair changes to [image]. The wire is connected to the new input port. The interior of the disconnected port will change to white. The interior of the connected port will change to black.

Note: Wires can only be moved from the input port, not the output port.

See also

Disconnecting a wire

Multiple wires on a single output port

Wiring components


Multiple wires on a single output port

Sending the same output to multiple components simultaneously is possible by connecting multiple wires to a single output port.

1. Wire the output port of one component to the input port of another.

2. Go back to the original output port and connect a second wire to the input port of a different component. The two wires coming from the output port will be connected to two different input ports, but will have the same output value when the system is run. You have just introduced parallel processing into your system.

3. Repeat these steps to connect additional components from the same output.

See also

Wiring components

Disconnecting a wire

Moving a wire from one input port to another.


Naming a module

When you save a component or a system as a module, you will enter:

the module name
the author's name
a brief description of the module.

This information is stored with the module and can be viewed from the Module Properties Page at any time.

After creating a module, this information can not be modified so that all authoring information is preserved.

See also

Saving a component as a module

Saving a system as a module

Module Properties Page


Navigating through the Explorer

The MathConnex Explorer has three tabs at the top:
Project
Modules
Components

The Project view of the Explorer assists in navigating through a project by providing a hierarchical tree view of the currently active system. This tree view identifies the components used to create your system by the labels you have given them.

You can navigate within the project by clicking on a component that appears in the Project tree. The currently active component will be highlighted in the Project tree as it is being viewed in the Worksheet.

The Modules view of the Explorer shows you modules that have been created. The module tree allows you to create new folders to categorize and organize these modules.

The Components view of the Explorer shows you the components that are available to be used in a MathConnex system. The component tree allows you to create new folders to categorize and organize these components. acroScience will dynamically add new system components to the Component view in future updates of MathConnex.


Opening an existing project

1.	Click [image], select Open from the File menu, or press Ctrl+O. The Open dialog box appears.

2.	In the Look In box, click the disk drive containing your MathConnex project.

3.	In the box below Look In, click the name of the project from the list of files displayed.

4.	Click Open. The project appears in the Worksheet.


Select the appropriate field to enter a title and labels for the X and Y axes of your graph. Use the Font button to select a font for each. The text in the edit field appears in the font and color you have chosen.


Parallel processing

Parallel processing allows multiple systems that follow independent paths to execute their components in the same time step.

In a MathConnex system, parallel paths of execution can be simulated in two ways:

1.	By placing two or more unconnected systems on the same worksheet.

2.	By branching along multiple paths by using multiple output wires from a single component. These wires may take different, possibly unrelated, paths through the system.

MathConnex simulates overall system execution by allowing all components that can run in a given time step to do so. The slowest component within the parallel paths of the system will "gate" the overall system performance.

MathConnex ensures that the process of running a system is repeatable. The system results are always reproducible, regardless of the number of parallel paths in the system.

See also

Multiple wires on a single output port


Pasting components

Note: You must have previously cut or copied a component for pasting to be an option.

1.	Click [image], select Paste from the Edit menu, or press Ctrl+V. The pasted component is inserted into the Worksheet..

2.	Move the pasted component to its new location in the Worksheet.

Tip	If you should paste a component by mistake, simply select Undo from the Edit menu (or press Ctrl+Z) to remove the component from the Worksheet.

See also

Copying components

Cutting components


Stop/Pause component

The Stop/Pause component stops running a system when it receives data on its input wire.

With the Stop/Pause component you can:

Stop or pause a running system.

Eliminate the need to use the Stop and Pause buttons found on the Toolbar.

Use programmatic pausing or halting of a running system.

Halt a system under certain conditions using the Conditional component.

To place the Stop/Pause component onto the Worksheet:

1. Drag and drop the Stop/Pause component icon from the Component Palettes.

2. Connect the output port of another component to the input port of the Stop/Pause component.

When you run a system containing the Stop/Pause component, the system will stop when a data value goes into the Stop/Pause component. Once you’ve inserted the Stop/Pause component you can make it beep when it becomes active. You can also make the component pause a system instead of stopping it by choosing Pause on Input from the component’s context menu.

The figure below shows how the Stop/Pause component is used to stop some systems.

See also

Beep When Active

Stopping vs. Pausing

Labeling components

Viewing a component as an object

Wiring components


Print Preview

1.	From the File Menu, click Print Preview.

2.	Click “Print” to print the project, or click “Close” to close the Print Preview screen. Your project prints as it appears in the print preview.

Note: The “Zoom In” button within the print preview screen allows you to zoom in to see the detail in your system. It doesn't affect the scale of printing.

Note: The magnifying glass within the Print Preview screen is used to target where you want to zoom in on your project.

See also

Printing a project


Printing a system
Printing a project

1.	Click [image], choose Print from the File menu, or press Ctrl+P. The Print dialog box appears.

2.	Highlight the appropriate printer.

3.	Select the appropriate print range.

4.	Select the number of copies to be printed.

5.	Click “OK.”

See also

Print preview


The Ranges group defines the minimum and maximum range of numbers appearing on the graph along a given axis. You have two options:

Auto Calculate- MathConnex automatically establishes the minimum and maximum ranges that should appear on the graph. These ranges will change as more data arrives depending on your setting for Data History on the Plot Properties page.

Fixed- The user establishes the minimum and maximum ranges in which to plot the data on the graph. Input data which falls outside either the fixed minimum or fixed maximum is discarded and not plotted on the graph.


Ramp component

The Ramp component generates a series of real scalar values. It is useful for problems which require iteration or incremental data.

To place the Ramp component onto the Worksheet:

1. Drag and drop the Ramp component icon from the Component Palettes.

2. Click on the component with the right mouse button and choose Properties from the context menu.

3. Click on the Ramp tab and specify the starting value and the increment/step value. For example, enter 5 as the “starting value” and 2 as the “step value” to generate the numbers 5,7,9, and so on.

When you Connect the output port of the Ramp component to another component and run the system, the Ramp component generates one value at a time. The attached component will receive each value as it is produced. If one value isn’t passed further along the system or if the attached component can’t accept more than one value, the Ramp won’t generate another value.

The example below shows the Ramp component generating values which are accumulated in the Inspector component.

See also

Labeling components

Viewing a component as an icon

Viewing a component as an object

Wiring components

Resizing a component


Read from a file
Read data from a file

To read data from a data file, you should:

1. Place the File Read/Write component onto the Worksheet to launch the setup Wizard.

2. Choose “Read from data source.”

4. Press “Next” to go to the second page of the Wizard.

5. From the drop down list in the File Source box, choose the type of data file you want to read from.

6. Type the path to the data file or use the “Browse” button to locate it.

7. Press “Finish.”

When you run a system containing the File Read/Write component, data will be read in from the data file every time the component is triggered.

See also

File Read/Write component

Write to a File


Renaming a module or component

1. Click.

2. Move the pointer over the module or component and click the right mouse button. The context menu appears.

3. Click Rename in the context menu. The Rename Item dialog box appears.

4. Type the new name.

5. Click OK. The dialog box closes and the new module or component name appears in the tree diagram.

See also

Creating a folder

Deleting a module

Renaming a folder


Renaming a folder

1.	Click.

2.	Move the pointer over the folder and click the right mouse button. The context menu appears.

3.	Click Rename Folder from the context menu. The Rename Folder dialog box appears.

4.	Type the new folder name.

5.	Click OK. The Rename Folder dialog box closes and the new folder name appears in the tree diagram.

See also

Creating a folder

Deleting a folder

Renaming a module or component


Resizing a component

You can see more or less of a component or you can stretch it.

To resize a component to see more or less of it:

1.	Double-click on the component to activate it.

2.	Move the cursor to one of the grab handles that appear until it changes to a double-headed arrow.

3.	Hold the left mouse button down and drag the cursor in the direction you want the component’s dimensions to change.

4.	Let go of the mouse button.

To stretch a component:

1.	Click once on it to select it (but not to activate it).

2.	Move the cursor to any of the grab handles that appear until it changes to a double-headed arrow.

3.	Hold the left mouse button down and drag the cursor in the direction you want the component’s dimensions to change.

4.	Let go of the mouse button.

To change a component back to its original size after stretching it:

1.	Click once on the component with the right mouse button.

2.	Choose View / Original Size from the context menu.

Note: Only selected components that are surrounded by grab handles can be resized.

See also

Moving a component

Selecting a single component

Selecting multiple components


Run to this Point

The Run to this Point command allows you to add a temporary breakpoint to your MathConnex system when you want to interrupt the system only once. This command will pause the system at the designated component only once. The next time the system is run, the temporary breakpoint is reset.

See also

Setting breakpoints

Using Run, Stop, Pause, and, Step

Using Run to this Point


Select the scaling factor for your graph:

Linear scale: The data values for the selected axis are plotted on a linear scale.

Logarithmic scale: The data values for the selected axis are plotted on a log 10 scale.

Note: The Graph component supports log-linear, linear-log, and log-log formats.


Define the styles for each set of input data.

Data Set- Use the list box to select the correct data set.

Line-Select line to produce a line graph. The Style button allows you to select the type of line.

Point-Select point to produce a graph of plotted points. The Font button allows you to define the font and select a symbol for the points.

Note: Select both Line and Point for a line graph with points overlayed.


Saving a component as a module

Saving a component as a module is a good way to customize the components in the Workspace. When you save a component as a module you are able to:

save settings such as inputs and outputs that have been entered

save all properties that have been entered on the Properties pages

save the size of the component

To save a component as a module:

1.	Click on the component in the Worksheet with the right mouse button. The context menu appears.

2.	Choose Save as a Module in the context menu. The Save Module dialog box appears.

3.	Enter the module's name, author's name, and a description of the module.

4.	Click OK. The module can be found in the Explorer by clicking on the Modules tab.

Tip	Saving a Graph component as a module allows you to use the same customized graph format each time you want a graph in your system without having to reconfigure it from scratch.

See also

Naming a Module

Saving a project

Saving a system as a module

Modules

Module Properties Page

The Explorer


Saving a project

In MathConnex you have the ability to save your work in two ways. You can choose to save your project in a file or you can choose to save your system as a module.

1.	Saving a project allows you to save your entire project in a file for easy retrieval.

2.	Saving a system as a module allows you to save your system so that you can build on it later as part of another system that you create.

To save your project in a file:

1.	Click [image], choose Save from the File menu, or press Ctrl+S. The Save As dialog box appears the first time a project is saved. If a filename has already been assigned the updated project is automatically saved to the filename.

2.	Enter the file name for the project.

3.	Enter the file type, drive, and directory.

4.	Press OK. The project is saved to the file.

See also

Saving a component as a module


Saving a system as a module

If you have a system that you want to use as part of a larger system, you can collapse it into a subsystem or save it as a module.

To save a component or a system of components as a module:

1.	Drag-select one or more components, or an entire system in the Worksheet.

2.	Click with the right mouse button on one of the selected components.

3.	Choose Save as a Module from the context menu. The Name Module dialog box appears.

5.	Enter the module name, author name, and description of the module.

8.	Click OK.

The new module appears in the tree diagram in the Explorer.

See also

Moving a module within the Explorer

Naming a module

Saving a component as a module

Modules

Module Properties Page

Selecting multiple components


Selecting a single component

1.	Move the pointer over a component in the Worksheet.

2.	Click on the component.

Note: To undo the selection, move the pointer to an empty area in the Worksheet and click. The component is no longer selected.

See also

Selecting multiple components

Resizing a component


Selecting multiple components

There are two commonly used methods to select multiple components:

Method 1: Region Selection

1.	Move the pointer near the group of components you wish to select. Do not point on any individual component.

2.	Click.

3.	Move the pointer so that the rectangle that is being drawn either intersects or encompasses all the components you wish to select.

4.	Release the mouse button. All selected components highlight. Components that are resizable are surrounded by grab handles.

Method 2: Shift+click

1.	Click on the first component to select it.

2.	Move the pointer over the next component to be selected.

3.	While pressing the Shift key, click the mouse button.

4.	Repeat steps 2 and 3 for each additional component you wish to select. All selected components highlight. Components that are resizable are surrounded by grab handles.

Note: Undo the selection by pressing Shift + click on each component that you wish to unselect.

See also

Selecting a single component


Sending a project via email
Sending a project via e-mail

Note: You must have a properly configured MAPI-compliant e-mail package to export a system via e-mail.

1.	From the MathConnex File menu, click Send. Your e-mail application opens with the current MathConnex project automatically embedded.

2.	Complete your usual steps for sending e-mail. The receiver of the email will be able to view your project by double-clicking the MathConnex icon.

Note: In order for your mail to be read, the receiver must have properly configured MathConnex Software, and must be able to receive email with embedded documents in MIME format.


Setting breakpoints

1.	Move the pointer over the component you are adding a breakpoint to.

2.	Click. The context menu appears.

3.	Click Add a Breakpoint in the context menu. The component becomes outlined in red.

4.	Run the system. The outline will turn yellow each time the breakpoint is reached.

Note: To remove the breakpoint repeat the above steps and select Remove Breakpoint from the context menu.

See also

Breakpoints

Using Run to this Point


Setting fonts in the Script Editor

You can set both the display and the printer fonts used by the Script Editor.

Note: This applies to the MATLAB and Scripted Object editors as well.

To set the display font

1.	Select Set Display Font from the View menu. The Font dialog box appears.

2.	Select the desired font name, style, and size.

3.	Click OK. The text in the Script Editor appears with the font settings you specified.

To set the printer font

1.	Select Set Printer Font from the View menu. The Font dialog box appears.

2.	Select the desired font name, style, and size.

3.	Click OK. When you print from the Script Editor, the text will be sent to the printer using the font settings you specified.


Showing labels

1.	From the MathConnex View menu, click Show Labels. The labels appear under the components that are in the Worksheet.

Note: MathConnex provides default labels for all components when they are dropped into the Worksheet or you can label these components yourself.

See also

Labeling components


Set the tick marks for each axis of your graph.

Major Tick Marks- the lines that appear at each interval set by Major Ticks.

Minor Tick Marks- the lines that appear at each interval set by Minor Ticks.

To set the tick marks:

1.	Select the axis in the Assign Settings For: field.

2.	Select Major Ticks.

A check appears in the box.

3.	Enter the interval in the highlighted box.

4.	Repeat for Minor Ticks.

5.	Select the other axis in the Assign Settings For: field.

6.	Repeat the steps.

7.	When you have made your selections, click OK.

The Axes Properties page closes and your selections are applied to the graph.


Module Properties page

The Module Properties Page holds the following information:
name of module
author
description
location

This properties page cannot be modified. The original authoring information was entered when the module was created.

See also

Saving a component as a module

Saving a system as a module

Naming a module


Text component

The Text component allows you to enter text directly in your MathConnex project. With the Text component you can:

insert text directly in the Worksheet

set the font, style, and size of the text

place text above, below, or beside components in the Worksheet

Note: The font settings are saved for each text component separately. You can drop several Text components in your Worksheet and set the fonts differently for each.

See also

Using the Text component to add text to a MathConnex project

Component Palettes

Inserting OLE objects

Labeling components


Graph component

The Graph component allows you to create two-dimensional graphs as components in your system.

When using the Graph component, you can:

Create customized graphs with ease.

Observe the data as it is being run through the system.

Incorporate color and fonts to enhance your graph.

Print your graph as it appears on the screen.

Compare multiple data sets.

Copy the graph to the Clipboard for embedding in other applications.

To place the Graph component onto the Worksheet:

1. Drag and drop the Graph component icon from the Component Palettes.

2. Connect the output port of another component to the input port of the Graph component.

When you run the system, the Graph component creates a plot based on xy data stored in two columns, where the first column contains the x-values and the second contains the y-values.

To control specifics about the graph:

1. Click on the component with the right mouse button.

2. Choose Properties from the context menu.

3. Use the Plot, Labels, and Axes tabs to adjust the settings.

Note: You can save your customized graph settings by saving the custom graph as a module. Fonts and plot characteristics are stored in the module and can be easily dropped into other worksheets.

See also

Graphing using Axum

Graph component properties: Axes

Graph component properties: Labels

Graph component properties: Plot

Copying the graph to the Clipboard

Adding and removing input or output ports

Wiring components

Viewing a component as an icon

Viewing a component as an object


Magnifying glass

The Magnifying Glass is a tool that helps you analyze your system by allowing you to view the data values on a wire.

Note: The magnifying glass only appears when the system is paused, not when stopped.


Undo a selection

For a single component:

Move the pointer to an empty area in the Worksheet. The component is no longer selected.

For multiple components:

Press Shift + click on each component that you wish to undo, or click in an empty area of the Worksheet to unselect all selected components.

See also

Selecting a single component

Selecting multiple components


Using Run to this Point

1.	Move the pointer over a component in the Worksheet. The context menu appears.

2.	Click Run to this Point in the context menu. The system automatically runs when you set Run to this Point. The component is outlined in red. When the system has reached the component, it will pause and the component's outline will turn green. You can resume running the worksheet by clicking the Run or Step buttons on the toolbar.

See also

Breakpoints

Run to this Point

Setting Breakpoints

Using Run, Stop, Pause, and Step


Using Run, Stop, Pause, and Step

You can interactively control the execution of a system using the Run, Stop, Pause, and Step buttons located on the Toolbar.

To Run a system:

1.	Click the Run button [image]. The system runs.

To Stop a system:

1.	Press the Stop button [image]. The system stops running.

Tip	If you click Run after you have stopped the system, it will restart the system from the beginning.

To Pause a system:

1.	Press the Pause button [image] while the system is running. The system will stop until you resume running by clicking the Run or Step button. While the system is paused, you can view input data on the wires using the magnifying glass.

To Step through a system:

1.	Click the Step button [image] to step through each step of the system one step at a time.

Tip	You must repeatedly click Step to continue moving through the system.

Note: Single Step Mode found in the Run menu allows you to control how you step through two parallel parts of the system.

To alternate through the steps in each system one at a time as each component is ready, select Single Step Mode so that a check appears next to it.

To move through each system together as each component is ready, select Single Step Mode so that the check next to it is removed.

Tip	MathConnex allows you to control whether or not the components are highlighted as the system is run. Click Highlight Components from the MathConnex Run menu to set the highlighting.

See also

Parallel processing

Using the Stop/Pause component to stop or pause a system


Using the Script Editor

To edit the statements contained in the Script Editor window:

1.	Click with the right mouse button on the component you want to edit.

2.	Choose Edit Script from the context menu.

The Script Editor opens showing the statements contained in the component.

3.	Edit the statements.

4.	Apply your changes, as described below.

To apply your changes and perform a syntax check

1.	Select Apply Changes from the File menu, click the [image] button, or press Ctrl+S. The changes are checked for correct language usage. If a syntax error is discovered, an error message appears.

2.	Correct the syntax error and repeat Step 1.

To exit the Script Editor

1.	Be sure you have applied any changes, as described above.

2.	Select Close & Return from the File menu, or press Esc. The Script Editor closes.

See also

Exporting from the Script Editor

Importing text into the Script Editor


Using the Stop/Pause component

To Pause the system:

1.	Drag the Pause-Stop component from the Component Palette to the Worksheet.

2.	Wire the Pause-Stop component to a component currently in the system.

4.	Click. The context menu appears.

5.	Click Pause on Input in the context menu.

6.	Run the system. The system will run until it reaches the Pause-Stop component. If you have also selected Beep When Active from the context menu, you will hear a tone to signal the pause.

7.	Click the Run button on the toolbar to resume running the system from the point it was paused.

To Stop the system:

1.	Drag and drop the Pause-Stop component from the Component Palette into the current system on the Worksheet.

2.	Wire the Pause-Stop component to a component currently in the system.

3.	Click on the Pause-Stop component with the right mouse button. The context menu appears.

4.	Click Stop on Input in the context menu.

5.	Run the system. The system will run until it reaches the Pause-Stop component. If you have also selected Beep When Active form the context menu, you will hear a tone signaling the halt.

6.	Click the Run button on the toolbar to run the system again from the beginning.

The figure below shows how the Stop/Pause component is used to stop some systems.

See also

Run, Stop, Pause, and Step

Breakpoints

Setting breakpoints

Run to this Point

Using Run to this Point

Wire Breaker component

Using the Wire Breaker


Using the Wire Breaker

To interrupt a connection:

1.	Drag the Wire Breaker component from the Component Palette to the Worksheet.

2.	Drop the Wire Breaker component between the two desired components in your MathConnex system.

3.	Reconnect the input and output wires of the two components so that they run through the Wire Breaker component.

4.	Click. The context menu appears.

5.	Click Disconnect the Wire in the context menu. The connection icon pictured on the component is broken.

6.	Run the system. The section of the system containing the Wire Breaker component will run until it reaches the Wire Breaker.

To reconnect:

1.	Click on the Wire Breaker component with the right mouse button. The context menu appears.

2.	Click Connect the Wire from the context menu. The connection icon pictured on the component connects and the system now runs uninterrupted.

See also

Wire Breaker component


Viewing input data

When your MathConnex system is paused, move the pointer to any input port in the system. The pointer changes to a [image]. If the data value of the wire is a scalar, the value appears in a small pop-up tool tip window. The tool tip remains visible while the cursor is over the port. If the data value is anything but a scalar, the tool tip shows the dimensions only.

See also

Magnifying Glass


Border Color- defines the color for the graph border.

Graph Color- defines the color for the graph background.

The current color for each is displayed next to the label. To change the color, click the color button.


What is a MathConnex project?

A MathConnex project is a system of mathematical components wired together to visualize the calculation of complex mathematical expressions.

With MathConnex you can:

Design, execute, and analyze your system without ever leaving the MathConnex Workspace.

Import text and graphics to annotate your system for presentation or publication.

Use an e-mail package in conjunction with MathConnex to share your projects with others via email.

Create system modules and use them as the basis for larger systems later.

MathConnex provides the following features to make designing and analyzing your system easy:

Wire components to construct a system that visually represents a mathematical problem to be solved.

Program user-defined functions using ConnexScript or MATLAB components.

Use the Run, Stop, Pause, and Step buttons on the toolbar to verify your system design.

Debug your system by interactively inspecting values on data wires.


What is a module?

A module is a MathConnex component that has been tailored or customized and then saved "as is" for reuse in other MathConnex systems. Any system component or group of components can be stored as a reusable module.

For example, you may wish to configure a Graph component with preferred font and color settings and then save it as a module. Now, whenever you need a Graph component, you can select your customized graph from the Module view in the Explorer, rather than having to select a Graph component from the Component Palettes and then reconfigure it to your preferred settings each time.

You can create your own modules and store them in the Modules section of the Explorer. User modules will carry the name of the author, date of creation, etc. These modules cannot be modified, only deleted, because authoring information should never be changed.

When you drop a module into a system, the component is just a copy of the module and can be modified and saved as a different module if desired.

See also

Adding a module to the Worksheet

Drag and drop modules

Exporting modules

Importing modules

Moving a module within the Explorer

Naming a Module

Navigating through the Explorer

Module Properties Page


Wire Breaker component

The Wire Breaker component selectively breaks the connection between two components in your MathConnex system. When the Wire Breaker component is set to the disconnect position, no data on that wire passes beyond it.

Using the Wire Breaker component allows you to selectively run parts of the system that may take a long time.

See also

Breakpoints

Component Palettes

Labeling components

Run to this Point

Viewing a component as an object

Setting breakpoints

Using the Wire Breaker


Wiring components

1. Move the pointer over a component's output port.
The pointer changes to [image].

2. Click.
The pointer changes to a cross hair while you travel to the destination port.

3. Release the mouse button when the pointer changes to [image].
The two components are now connected by a wire, and the input and output ports are black.

See also

Adding and removing input or output ports

Disconnecting wires

Multiple wires on a single output port


Write to a file

To write data to a data file, you should:

1. Place the File Read/Write component onto the Worksheet to launch the setup Wizard.

2. Choose “Write to data source.”

4. Press “Next” to go to the second page of the Wizard.

5. From the drop down list in the File Source box, choose the type of data file you want to create.

6. Type the path to the data file or use the “Browse” button to locate it.

7. Press “Finish.”

When you run the system, data will be written to the data file every time the component is triggered. Data already in the data file will be overwritten unless you specify otherwise.

Note: When Select is used to select a file and the file extension is known to be supported by the Data Input/Output component, the format will automatically change.

See also

File Read/Write component

Read from a File


Optionally overwriting existing data

If you want to optionally overwrite existing data in a data file, click on the File Read/Write component with the right mouse button and choose Overwrite from the context menu. When the component is triggered, MathConnex will ask you whether you want to overwrite the existing data.


Zoom In & Zoom Out

The Zoom In & Zoom Out commands narrow or expand the viewing focus of your project. The Zoom In command allows you to view one section of the system more closely. The Zoom Out command allows you to view a larger section of the system in its entirety.

To Zoom In on a system:

1.	From the MathConnex menu, click [image], or select Zoom In from the View menu.

2.	Repeat Step 1 until you have scrolled the desired portion into view.

To Zoom Out on a system:

1.	From the MathConnex menu, click [image], or select Zoom Out from the View menu.

2.	Repeat Step 1 until you have scrolled the desired portion into view.

Note: Zoom settings are saved with the project. The system will print as it is seen on the screen.

Tip	You can use the Zoom Out feature to expand your view of the Worksheet so that you can print more of your system on a single page.


Collapsing part of a system into a subsystem

MathConnex allows you to collapse the display of one or more components into a subsystem on your Worksheet. In this way you hide or nest details about the components in your system and create an additional level in the Worksheet.

To create a subsystem in your system:

1. Select one or more components in the Worksheet.

2. Click on one of the selected components with the right mouse button to see the context menu.

3. Choose Collapse.

MathConnex displays a collapsed subsystem using a subsystem icon in the Worksheet.

To see and edit the contents of the subsystem:

1. Double-click on the subsystem icon which opens up a new Worksheet level containing the components of the subsystem. MathConnex displays another icon in this view to indicate that the system contains components at other levels.

2. Edit the components in the subsystem as you normally would.

3. Return to the Worksheet level in which the subsystem displays as an icon by choosing Go Back on the View menu.

To restore a subsystem to its uncollapsed appearance:

1. Click on the subsystem icon in the Worksheet with the right mouse button.

2. Choose Expand from the context menu.

See also

Viewing part of a subsystem in the first level worksheet

Locking a subsystem


Viewing part of a subsystem

When you create a subsystem by collapsing part of a system, and especially if you have locked it, you’ll usually want to leave all the components in it hidden when you run the system. However, to view a particular subsystem component in a higher Worksheet level, do the following:

1. Open the subsystem containing that component by double-clicking on the subsystem icon.

2. Click on the component to view once with the right mouse button.

3. Choose View / In Parent from the context menu.

Now when you go back to the higher Worksheet level by choosing Go Back from the View menu, you will see the corresponding component in place of the icon that otherwise denotes a collapsed subsystem. The component can only be edited, however, in the Worksheet level it came from.

See also

Creating, viewing, and editing a subsystem

Locking a subsystem


Locking a subsystem

You can lock a subsystem so its contents can only be viewed and edited after a password is entered. To do so:

1. Click on the subsystem icon with the right mouse button.

2. Choose Lock from the context menu.

3. Enter a password in the dialog box.

You will be prompted for the password the next time you try to view the contents of the subsystem by double-clicking on the subsystem icon.

See also

Creating, viewing, and editing a subsystem

Viewing part of a subsystem in the first level worksheet


Viewing a component as an icon

By default, some components are designed to show calculations or certain property settings when they are inserted. For example, the Conditional component defaults to displaying all the conditional statements when you insert it. One way to hide the calculations or statements behind a component is to display the component as an icon.

To display a component as an icon:

1. Click on the component with the right mouse button to bring up its context menu.

2. Choose View / As Icon so that it is checked.

You’ll see a default icon that is similar to the component’s icon in the Component Palettes.

To choose an icon other than the default, click on the component/icon and choose Object / Convert from the Edit menu. Then click on the “Change Icon” button.

To display the component in its default form again:

1. Click on the component with the right mouse button to bring up its context menu.

2. Choose View / As Icon so that it is no longer checked.

Note: When you double-click on a component that is displayed as icon, you will see a separate editing window for components that usually activate in-place.

See also

Collapsing part of a system

Viewing a component as an object


Viewing a component as an object

By default, some components are designed to show calculations or certain property settings when they are inserted. One way to hide the calculations or statements behind a component is to display the component as an icon. Another way is to display the component as an object.

To display a component as an object:

1. Click on the component with the right mouse button to bring up its context menu.

2. Choose View / New Object.

3. Choose an appropriate object in the Insert Object dialog box.

4. Create the new object.

5. Click away from the component.

The component’s appearance will change to that of the object you created.

To edit the object:

1. Click on the component with the right mouse button to bring up its context menu.

2. Choose View / Edit Object. The object activates in place or inside the application that created it.

3. Make the necessary changes.

4. Click away from the component to resume working in MathConnex.

To display a component in its default form again:

1. Click on the component with the right mouse button.

2. Choose View / Revert Object from the context menu.

See also

Collapsing part of a system

Viewing a component as an icon


Using the Script Editor

To edit the statements contained in the Script Editor window:

1.	Click with the right mouse button on the component you want to edit.

2.	Choose Edit Script from the context menu.

The Script Editor opens showing the statements contained in the component.

3.	Edit the statements.

4.	Apply your changes, as described below.

To apply your changes and perform a syntax check

1.	Select Apply Changes from the File menu, click the [image] button, or press Ctrl+S. The changes are checked for correct language usage. If a syntax error is discovered, an error message appears.

2.	Correct the syntax error and repeat Step 1.

To exit the Script Editor

1.	Be sure you have applied any changes, as described above.

2.	Select Close & Return from the File menu, or press Esc. The Script Editor closes.

See also

Exporting from the Script Editor

Importing text into the Script Editor


AND logical (Boolean) operator

Operator

&

Description

The & operator returns "true" (value = 1) whenever both of its operands are true; otherwise it returns "false" (value = 0). Any nonzero values are considered true. For complex logical comparisons, the magnitude of the complex value is used.

Example

x = 2

y = 4

out0 = (x<3)&(y==4) // evaluates to 1


Math function contents
Absolute value (abs)

Addition

AND logical (Boolean) operator

Arc/inverse cosecant (acsc, acsch)

Arc/inverse cosine (acos, acosh)

Arc/inverse cotangent (acot, acoth)

Arc/inverse secant (asec, asech)

Arc/inverse sine (asin, asinh)

Arc/inverse tangent (atan, atanh)

Arithmetic operators

Basic functions

Braces

Brackets

Ceiling (ceil)

Colon

Columns (cols)

Comma

Complex conjugate (conj)

Complex math functions

Cosecant (csc)

Cosine (cos)

Cotangent (cot)

Determinant (det)

Division

Elementwise array multiplication

Elementwise array power

Elementwise array division

Equal to (==) relational operator

Exponential (exp)

Floor

Gamma function (gamma)

Greater than or equal to (>=) relational operator

Greater than (>) relational operator

Hyperbolic cosecant (csch)

Hyperbolic cosine (cosh)

Hyperbolic cotangent (coth)

Hyperbolic secant (sech)

Hyperbolic sine (sinh)

Hyperbolic tangent (tanh)

Hyperbolic trigonometric functions

Imaginary part (im)

Indexing notation characters

Inverse trigonometric functions

Less than or equal to (<=) relational operator

Less than (<) relational operator

Log base 10 (log10)

Log base 2 (log2)

Logical (Boolean) operators

Matrix functions

Matrix operators

Maximum (max)

Minimum (min)

Modulus (mod)

Multiplication

Natural logarithm (ln)

Not equal to (!=) relational operator

NOT logical (Boolean) operator

OR logical (Boolean) operator

Power

Pi

Real part (re)

Relational operators

Rows

Round

Secant (sec)

Semicolon

Signum (sign)

Sine (sin)

Special characters

Square root (sqrt)

Subtraction

Tangent (tan)

Time

Trigonometric functions

Truncate (trunc)

xor logical (Boolean) operator


NOT logical (Boolean) operator

Operator

~

Description

The ~ character represents the Boolean inverse operator. This operation has only one operand. Not "true" in this case means false and not "false" means true. For real operands the result is 1 if the operand is equal to zero; otherwise the result is 0.

Example

out1 = ~0   // Evaluates to 1


OR logical (Boolean) operator

Operator

|

Description

The | character represents the Boolean inclusive operator, OR. For real arguments, OR returns the first operand if it is nonzero; otherwise it returns the second operand.

Example

x = 3

y = 5

out0 = (x<4)|(y>10)  // evaluates to 1


Hyperbolic trigonometric functions

Function	Returns
acsch acosh acoth asech asinh atanh cosh coth csch sech sinh tanh	arc/inverse hyperbolic cosecant arc/inverse hyperbolic cosine arc/inverse hyperbolic cotangent arc/inverse hyperbolic secant arc/inverse hyperbolic sine arc/inverse hyperbolic tangent hyperbolic cosine hyperbolic cotangent hyperbolic cosecant hyperbolic secant hyperbolic sine hyperbolic tangent

Description

Defined from the Euler equation. sinh, cosh, tanh, sech, csch, and coth are all defined in the same manner as for regular trigonometric functions, with angles expressed as radians. For complex numbers, the complex power relation comes into play.

Input/Output

Input allowed is real or complex, scalar, vector, or array. Output produced is scalar, vector, or array of the same size, real or complex depending on range and input type.


Inverse trigonometric functions

Function	Returns
acsc, acsch acos, acosh acot, acoth asec, asech asin, asinh atan, atanh	arc/inverse cosecant, arc/inverse hyperbolic cosecant arc/inverse cosine, arc/inverse hyperbolic cosine arc/inverse cotangent, arc/inverse hyperbolic cotangent arc/inverse secant, arc/inverse hyperbolic secant arc/inverse sine, arc/inverse hyperbolic sine arc/inverse tangent, arc/inverse hyperbolic tangent

Description

Inverse of sin, sinh, cos, cosh, etc. Returns the angles expressed in radians. Real for real input between –1 and 1 for sin and cos, but complex for input outside those parameters as well as for complex input.

For complex input:

asin(z) = -i*ln(iz + (1-z2)1/2)

acos(z) = -i*ln(z + i*(1-z2)1/2)

atan(z) = ln((I + z)/(I - z))

asinh(z) = ln(z + (z2 + 1)1/2)

acosh(z) = ln(z + (z2-1)1/2)

atanh(z) = 0.5*ln((1 + z)/(1-z))


Trigonometric functions

Function	Returns
cos sin tan sec csc cot	cosine sine tangent secant cosecant cotangent

Description

The trigonometric functions operate on scalars or element by element on matrices. For real x, sin(x)=y/l, and cos(x)=x/l for a right triangle with hypotenuse of length l, width of length x, and height of length y.

Where x is complex, cos(x) = cos(re(x))cosh(im(x)) + i*sin(re(x))sinh(im(x)) and sin(x) = cos(re(x))sinh(im(x)) + i*sin(re(x))cosh(im(x)).

All others may be constructed from sin and cos: tan=sin/cos, cot=1/tan, sec=1/cos, csc=1/sin even for complex arguments.


Elementwise matrix operators
Elementwise matrix operators .*  ./  .^

Synopsis

A.*B	elementwise multiplication of the arrays A and B

A./B	elementwise array division, equivalent to A.*B.^ -1

A.^B	elementwise array power

Description

Array arithmetic operations are performed element-by-element and are distinguished from matrix operations by the period character (.).

Operator	Name of Operator
.* ./ .^	elementwise multiplication elementwise division elementwise power


Arithmetic operators
Arithmetic operators  +  –  *  /   ^

Synopsis

A + B  	addition of A and B

A - B	subtraction of B from A

A * B	multiplication of  A and B

A / B	division of A by B

A ^ B	power

Description

Operation performed on two values of varying types as defined by the rules of linear algebra.

Operator	Name of Operator
+ - * / ^	addition subtraction multiplication division power


Basic functions

The basic algebraic math functions supported by ConnexScript are listed in the table below.

Function	Returns
abs ceil exp floor log10 log2 ln max  min  mod nelem round rows sign sqrt  time trunc	absolute value ceiling exponential floor log base 10 log base 2 natural logarithm maximum minimum modulus number of elements round rows  sign square root time truncated value


Complex math functions

Function	Returns
conj im re	complex conjugate imaginary part real part


Indexing notation characters
Indexing notation characters  , ;  : [ ]  { }

These characters are used for indexing operations:

,	(comma)—separates each dimension of the array

:	(colon)—indicates the entire dimension (range of elements in the row or column)

;	(semicolon)—indicates the next dimension

[ ]	(brackets)—used to index into an array

{ }	(braces)—used to create a static array

ConnexScript uses zero-based indexing, so 0 is the first element, 1 is the second element, etc.

Synopsis

x = {1,2,3; 4,5,5}

y = x[1;2]

y = x[1;:] means y = all columns in the 1st row of x

y = x[:;1] means y = all rows in the 1st column of x

y = x[:] effectively "flattens" all values in x, creates a vector from array x

See also

Creating indices


Logical (Boolean) operators
Logical (Boolean) operators  & |  ~  xor

The logical (Boolean) operators in ConnexScript are:

& 	(AND)

| 	(OR)

~	(NOT)

xor 	(exclusive OR)

Synopsis

A & B

A | B

A ~ B

A xor B

Description

The symbols &, |, ~ and xor represent the logical (Boolean) operators AND, OR, NOT and XOR (exclusive OR). All four operations return values of either one or zero, indicating "true" (value = 1) or "false" (value = 0) based on the given relation.


Matrix functions

The ConnexScript functions for performing the basic matrix operations are listed in the table below.

Function	Returns
cols det rows	columns determinant rows


Relational operators
Relational operators ==  !=  >  >=  <  <=

Purpose

Relational operators may be used to test the relationship between two arguments.

Description

The six relational operators in ConnexScript are:

Operator	Name of Operator
== != > >= < <=	equal to not equal to greater than greater than or equal to less than less than or equal to

All relational operations apply a relation to two operands and return a value of either "true" (value = 1) or "false" (value = 0). Relational operations may be applied to matrices, in which case an element-by-element comparison is conducted. In this case, the operation returns a matrix of the same size with values of either one or zero, indicating true (value = 1) or false (value = 0) based upon the given relation. The matrix of zeros and/or ones thus generated may be used as an operand.

Synopsis

A == B

A != B

A > B

A >= B

A < B

A <= B


Special characters
Special characters   =  _

The special characters in ConnexScript are:

= 	(assignment)

_ 	(underscore)

= character

Assigns left-hand side of equation the value(s) listed on the right-hand side.

_ character

Continuation character used when inputting multiple lines of data. Statements may be continued on the following line or lines by entering a space and the underscore character. A statement may be continued on any number of lines using the underscore character.

Note: A space must be inserted before the underscore character for continuation because the underscore character may be used in variable names, e.g,. X_ is a valid variable name, while X [space]_ denotes continuation.


xor logical (Boolean) operator

Operator

xor

Description

The Boolean exclusive OR operator is similar to OR but differs in that when both arguments are true, the result returned is false.

Examples

out0 = 1 xor 1  // evaluates to 0

out1 = 1 xor 0  // evaluates to 1


Absolute value (abs)

Function

abs

result = abs(x)

Description

Returns the absolute value of x, a scalar, vector or matrix of real or complex value. For all data types other than complex, abs(x) returns a value of the same form as x; e.g., abs(x) returns –x for x<0 and x for x>0. If the input variable is complex, it returns the magnitude of x, i.e., sqrt(a*a + b*b) for x = a + ib. If x is an array, abs(x) returns the same structure with each element containing the absolute value of the corresponding element of x.

Input

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX	    X	    X	   X

Output

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX

Example

x = {0.7000 + 0.0000I, -2.0000 + 0.0000i}

out0 = abs(x)  // evaluates to  { 0.7000, 2.0000 }


Arc/inverse cosecant (acsc, acsch)

Function

acsc (arc or inverse cosecant)

acsch (arc or inverse hyperbolic cosecant)

result = acsc(x)

result = acsch(x)

Description

acsc(x) returns the arc or inverse cosecant of x, which may be a parameter of any size or type. The return value is complex both for complex input and for real input between the bounds of –1 to 1.

acsch(x) returns the arc or inverse hyberbolic cosecant of x, which may be a parameter of any size or type. Return value is complex for complex input and real for real input.

Input

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX	    X	    X	   X

Output

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX	    X	    X	   X

Reference

O'Neill, Peter V., “Advanced Engineering Mathematics,” Second Edition, Wadsworth Publishing Company, 1987


Arc/inverse cosine (acos, acosh)

Function

acos (arc or inverse cosine)

acosh (arc or inverse hyperbolic cosine)

result = acos(x)

result = acosh(x)

Description

acos(x) returns the arc cosine or inverse cosine of x, which may be a parameter of any size or type. Return value is complex both for complex input and for real input outside the bounds of cosine (–1 to 1).

acosh(x) returns the arc or inverse hyberbolic cosine of x, which may be a parameter of any size or type. Return value is complex both for complex input and for real input outside the bounds of cosh (1 to infinity).

Input

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX	    X	    X	   X

Output

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX	    X	    X	   X

Reference

O'Neill, Peter V., “Advanced Engineering Mathematics,” Second Edition, Wadsworth Publishing Company, 1987


Arc/inverse cotangent (acot, acoth)

Function

acot (arc or inverse cotangent)

acoth (arc or inverse hyperbolic cotangent)

result = acot(x)

result = acoth(x)

Description

acot(x) returns the arc cotangent or inverse cotangent of x, which may be a parameter of any size or type. Return value is complex for complex input and real for real input.

acoth(x) returns the arc or inverse hyperbolic cotangent of x, which may be a parameter of any size or type. Return value is complex both for complex input and for real input inside the bounds of (–1 to 1).

Input

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX	    X	    X	   X

Output

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX	    X	    X	   X

Reference

O'Neill, Peter V., “Advanced Engineering Mathematics,” Second Edition, Wadsworth Publishing Company, 1987


Arc/inverse secant (asec, asech)

Function

asec (arc or inverse secant)

asech (arc or inverse hyperbolic secant)

result = asec(x)

result = asech(x)

Description

asec(x) returns the arc secant or inverse secant of x, which may be a parameter of any size or type. Return value is complex both for complex input and for real input inside the bounds of (–1<x<1).

asech(x) returns the arc or inverse hyperbolic secant of x, which may be a parameter of any size or type. Return value is complex both for complex input and for real input where (x<0).

Input

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX	    X	    X	   X

Output

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX	    X	    X	   X

Reference

O'Neill, Peter V., “Advanced Engineering Mathematics,” Second Edition, Wadsworth Publishing Company, 1987


Arc/inverse sine (asin, asinh)

Function

asin (arc or inverse sine)

asinh (arc or inverse hyperbolic sine)

result = asin(x)

result = asinh(x)

Description

asin(x) returns the arc sine or inverse sine of x, which may be a parameter of any size or type. Return value is complex both for complex input and for real input outside the bounds of sine (–1<x<1).

asinh(x) returns the arc or inverse hyperbolic sine of x, which may be a parameter of any size or type. Return value is complex for complex input and real for real input.

Input

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX	    X	    X	   X

Output

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX	    X	    X	   X

Reference

O'Neill, Peter V., “Advanced Engineering Mathematics,” Second Edition, Wadsworth Publishing Company, 1987


Arc/inverse tangent (atan, atanh)

Function

atan (arc tangent)

atanh (arc hyberbolic tangent)

result = atan(x)

result = atanh(x)

Description

atan(x) returns the arc tan or inverse tan of x, which may be a parameter of any size or type. Return value is complex for complex input and real for real input.

atanh(x) returns the arc or inverse hyperbolic tan of x, which may be a parameter of any size or type. Return value is complex both for complex input and for real input outside the bounds of  (–1<x<1).

Input

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX	    X	    X	   X

Output

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX	    X	    X	   X

Reference

O'Neill, Peter V., “Advanced Engineering Mathematics,” Second Edition, Wadsworth Publishing Company, 1987


Elementwise array multiplication

Operator

.*

result = A.*B

where dimensions of A and B must be the same or either A or B is a scalar.

Description

Elementwise array multiplication, represented by A.*B, yields the element-by-element product of the arrays A and B. A and B must have equal dimensions, unless one of them is a scalar.

Input/Output

You are allowed to input arrays of the same dimension, unless one of them is a scalar. Output produced is the same form as input.


Elementwise array power

Operator

.^

result = x.^a

Description

Raises a variable to a specified power. X.^p is equivalent to array X to the power of p, where p must be a scalar or an array of the same size as X. If one or more of the operands is a complex variable, then power has a different definition. A complex number raised to an integer is represented as a polynomial expansion of (a + i*b)^n. However, when n is a real number, z^1/n = (r^1/n)[cos((q + 2*k*pi)/n) + i*sin((q + 2*k*pi)/n)] where z=r*[cos(q) + i*sin(q)] and r is the absolute value of z and q the phase angle. For complex numbers raised to complex values, the formula is as follows:  z^a=exp(a*ln(z)) where a*ln(z) multiplies out to contain real and complex parts. If a*ln(z) = b, then z^a=exp(re(b)) * (cos(im(b)) + i*sin(im(b))).

Input/Output

Input allowed is real or complex. Output produced is an array of the same size as the input array and either real or complex.

Example

x = { 1.0000, 2.0000, 3.0000 }

out1 = x.^2    // evaluates to { 1.0000, 4.0000, 9.0000 }


Elementwise array division

Operator

./

Description

A./B is equivalent to elementwise division of array A by array B.

Input/Output

Input allowed is any size or type, but dimensions must match unless one of the input variables is a scalar.

Example

x = { 1.0000, 2.0000, 3.0000 }

y = { 2.0000, 2.0000, 2.0000 }

out0 = x./y // evaluates to  { 0.5000, 1.0000, 1.5000 }


Braces

Operator

{ }

{ expr, expr ; expr, expr }

Description

Used to create a static array. In a static array, the semicolon indicates a new row.

Example 1

A = {1,2,3; 4,5,6; 7,8,9} 	// creates a matrix A consisting

// of 3 rows and 3 columns

Example 2

y = 1:10	// creates a 1-by-10 vector - default step 1

z = 10:1	// automatically step -1

B = { y ; z } 	// creates a 2-by-10 array, 1st row y, 2nd row z

See also

Creating a vector or matrix


Brackets

Operator

[ ]

[row_index1, row_index2, . . . ; column_index1, column_index2, . . . ]

Description

Used to index into an array. Arrays are indexed row major. The semicolon is used to separate row and column index specifications. Index values must be real, but can be either scalar or vector. When vector index values are used, each element of the vector represents an index value for the given dimension. Index values need not necessarily be sequential.

Example 1

x = A[1,2;0]	// x = the 1st element from the 2nd

// and 3rd rows of matrix A

Example 2

x = A[x*y]	// extracts the element at position x*y,

// assuming x and y are scalar

Example 3

x = A{x;4,5]	// extracts 4th and 5th column for the rows

// specified in the vector x

Example 4

x = A[:]	// the colon is a wildcard when used alone;

// flattens A to become a vector

Example 5

B[:] = x	// wildcard assignment; B assigned elements

// from x, but keeps original dimension of B

See also

Creating indices


Ceiling (ceil)

Function

ceil

result = ceil(x)

Description

Rounds variable x up to nearest integer in the direction of positive infinity. If x is complex, ceil(x) rounds both real and imaginary parts towards infinity (i.e., the integer closest to x and towards infinity). x can be of any data type or size.

Input

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX	    X	    X	   X

Output

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX	    X	    X	   X

See also

Floor


Colon

Operator

:

Description

When used in array indexing, the colon represents a "wildcard" to denote either the entire dimension (row or column) or a one-dimensional flattening of the entire array.

When used in vector creation, the colon represents a separator for the start, step, and end values.

Examples

b = A[3;:]	// extract the 4th row of A

x = A[:]	// 1-d flattening of A

y = 1:10	// 1-by-10 vector - default step 1

See also

Creating indices

Creating a vector or matrix


Columns (cols)

Function

cols

result = cols(x)

Description

Returns the number of columns in a given matrix/array.

Input

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX	    X	    X	   X

Output

Scalar	Vector	Array

REAL	    X

COMPLEX

See also

Rows


Comma

Operator

,

Description

Separates values in array creation and in array indexing.

Example

y = A{x;4,5]	// extracts 4th and 5th column for the rows

// specified in the vector x

See also

Creating indices

Creating a vector or matrix


Complex conjugate (conj)

Function

conj

result = conj(x)

Description

conj(x) returns the complex conjugate of x. If x is complex (i.e. x = (a+i*b)), conj(a + i*b)= a - i*b. For real x, conj(x)=x. If x is an array, the result has the same structure with each element containing the complex conjugate of the corresponding element of x.

Input

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX	    X	    X	   X

Output

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX	    X	    X	   X


Cosecant (csc)

Function

csc

result = csc(x)

Description

csc(x) returns an array equivalent in size to x containing the cosecant of the elements of x (in radians).

Input

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX	    X	    X	   X

Output

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX	    X	    X	   X


Cosine (cos)

Function

cos

result = cos(x)

Description

cos(x) returns an array equivalent in size to x containing the cosine of the elements of x (in radians)

Input

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX	    X	    X	   X

Output

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX	    X	    X	   X


Cotangent (cot)

Function

cot

result = cot(x)

Description

cot(x) returns an array equivalent in size to x containing the cotangent of the elements of x (in radians)

Input

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX	    X	    X	   X

Output

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX	    X	    X	   X


Determinant (det)

Function

det

result = det(x)

Description

Returns the determinant of x. x can be any size or type, but must be square.

Input

Scalar	Vector	Array

REAL	    X	    	    X	Square Matrices only

COMPLEX	    X	    	    X

Output

Scalar	Vector	Array

REAL	    X	    	    X

COMPLEX	    X	    	    X


Equal to relational operator
Equal to (==) relational operator

Operator

==

Description

The == operator returns "true" (value = 1) if both operands are equal; otherwise it returns "false" (value = 0). Complex numbers are compared on the basis of magnitude.

Example

out1 = 3==4   // evaluates to 0


Exponential (exp)

Function

exp

result = exp(x)

Description

Returns the value of e (2.71828...) to the power of x. x may be any size or type. For an array, exp(x) returns e^x for each of the elements of x. For complex variables, the complex exponential is used: exp(z) = exp(re(z))*(cos(im(z)) + i*sin(im(z)).

Input

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Output

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

See also

Natural logarithm (ln)


Floor

Function

floor

result = floor(x)

Description

Rounds x down to the nearest integer in the direction of negative infinity. x can be any size or type.

Input

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Output

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X


Gamma function (gamma)

Function

gamma

result = gamma(x)

Description

gamma(x) returns the gamma function evaluated at the elements of x. x can be any size, but must be real.

Input

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX

Output

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX

Reference

DGAMLN from the AMOS package. Author: Amos, Donald E., Sandia National Laboratories


Greater than or equal to relational operator
Greater than or equal to (>=) relational operator

Operator

>=

Description

The >= operator returns "true" if the operand on the left is greater than or equal to the operand on the right; otherwise it returns a "false" (value = 0). Complex numbers are compared on the basis of magnitude.

Example

out1 = 3>=4   // evaluates to 0


Greater than relational operator
Greater than (>) relational operator

Operator

>

Description

The > operator returns "true" if the operand on the left is greater than the operand on the right; otherwise it returns a "false" (value = 0). Complex numbers are compared on the basis of magnitude.

Example

out0 = 4>3  // evaluates to 1


Hyperbolic cosecant (csch)

Function

csch

result = csch(x)

Description

csch(x) returns a matrix equivalent in size to x containing the hyperbolic cosecant (1/sinh(x)) of the elements of x.

Input

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Output

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

See also

Arc/inverse cosecant (acsc, acsch)

Cosecant (csc)


Hyperbolic cosine (cosh)

Function

cosh

result = cosh(x)

Description

cosh(x) returns a matrix equivalent in size to x containing the hyperbolic cosine of the elements of x. This is calculated as follows: cosh(x)=(e^x + e^x)/2.

Input

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Output

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

See also

Arc/inverse cosine (acos, acosh)

Cosine (cos)


Hyperbolic cotangent (coth)

Function

coth

result = coth(x)

Description

coth(x) returns a matrix equivalent in size to x containing the hyperbolic cotangent (cosh(x)/sinh(x)) of the elements of x.

Input

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Output

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

See also

Arc/inverse cotangent (acot, acoth)

Cotangent (cot)


Hyperbolic secant (sech)

Function

sech

result = sech(x)

Description

sech(x) returns a matrix equivalent in size to x containing the hyperbolic secant (1/cosh(x)) of the elements of x.

Input

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Output

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

See also

Arc/inverse secant (asec, asech)

Secant (sec)


Hyperbolic sine (sinh)

Function

sinh

result = sinh(x)

Description

sinh(x) returns a matrix equivalent in size to x containing the hyperbolic sine of the elements of x. sinh(x) is defined as (e^x-e^-x)/2.0.

Input

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Output

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

See also

Arc/inverse sin (asin, asinh)

Sine (sin)


Hyperbolic tangent (tanh)

Function

tanh

result = tanh(x)

Description

tanh(x) returns a matrix equivalent in size to x containing the hyperbolic tangent (sinh(x)/cosh(x)) of the elements of x.

Input

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Output

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

See also

Arc/inverse tangent (atan, atanh)

Tangent (tan)


Imaginary part (im)

Function

im

result = im(x)

Description

Returns the imaginary part of a number. If x is real, im(x) = 0.

Input

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Output

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX

Example

y = 2.0000 + 1.3170i

out0 = im(y)  // evaluates to 1.3170


Less than or equal to relational operator
Less than or equal to (<=) relational operator

Operator

<=

Description

The <= operator returns "true" if the operand on the left is less than or equal to the operand on the right; otherwise it returns a "false" (value = 0). Complex numbers are compared on the basis of magnitude.

Example

out1 = 3<=4  // evaluates to 1


Less than relational operator
Less than (<) relational operator

Operator

<

Description

The < operator returns "true" if the operand on the left is less than the operand on the right; otherwise it returns a "false" (value = 0). Complex numbers are compared on the basis of magnitude.

Example

out1 = 3<4   // evaluates to 1


Log base 10 (log10)

Function

log10

result = log10(x)

Description

log10(x) computes the base 10 logarithm of x. x can be any size or type. log10(0)produces an error.

Input

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Output

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

See also

Natural logarithm (ln)

Log base 2 (log2)

Exponential (exp)


Log base 2 (log2)

Function

log2

result = log2(x)

Description

log2(x) computes the base 2 logarithm of x, using the formula log2 = ln(x)./ln(2). x can be any size or type. log2(0) produces an error.

Input

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Output

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

See also

Natural logarithm (ln)

Log base 10 (log10)

Exponential (exp)

Matrix power ^


Addition

Operator

+

result = expression1 + expression2

where	result is any numeric variable

expression1 is any expression

expression2 is any expression

Description

A + B adds the scalars or matrices A and B according to the rules of linear algebra.


Multiplication

Operator

*

result = number1*number2

where	result is any numeric variable

number1 is any numeric expression

number2 is any numeric expression

Description

A * B yields the linear algebraic product of the matrices A and B. For matrix multiplication, the number of columns of A must equal the number of rows of B, unless one of them is a scalar. A scalar can multiply a matrix of any dimension.


Power

Operator

^

result = A^B

Description

A^B is equivalent to matrix A with elements (i,j) to the power of scalar B. Matrix A must be square and B must be a scalar. If the exponent is a positive integer then the result is equal to the root multiplied by itself, the number of times specified by the exponent. If the exponent is not a positive integer, then the result is equal to the eigenvalue decomposition with the eigenvalue matrix raised to the specified power (i.e. A = Q*L*inv(Q) where Q and its inverse are made up of eigenvectors of the matrix A and L is the diagonal matrix composed of eigenvalues. In this case A^B = Q*L^B*inv(Q)). Matrix must be square and nonsingular.

Input/Output

Input allowed is square matrix only, real and complex for the root and scalar only for the exponent. Output is matrix of the same size, real or complex depending on input.

Note: Elementwise matrix power yields a different result.


Division

Operator

/

result = number1/number2

where 	result is any numeric variable

number1 is any numeric expression

number2 is any numeric expression

Description

For matrices, A/B is roughly equivalent to A * inv(B). The dimensions of the denominator must be square.


Subtraction

Operator

–

Syntax 1

result = number1 - number2

Syntax 2

-number

where	result is any numeric variable

number1 is any numeric expression

number2 is any numeric expression

number is any numeric expression

Description

A - B subtracts the matrix B from matrix A. The operation is the same for elementwise array subtraction. A and B must have the same dimensions, or one of them can be a scalar. A scalar can be subtracted from a matrix of any dimension.


Maximum (max)

Function

max

result = max(x)

Description

Returns the maximum value of x. If x is complex, then the absolute value  (abs(x)) is used to determine the maximum value.

Input

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Output

Scalar	Vector	Array

REAL	    X

COMPLEX	    X

See also

Absolute value (abs)

Minimum (min)


Minimum (min)

Function

min

result = min(x)

Description

Returns the minimum value of x. If x is complex, then the absolute value (abs(x)) is used to determine the minimum value.

Input

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Output

Scalar	Vector	Array

REAL	    X

COMPLEX	    X

See also

Absolute value (abs)

Maximum (max)


Natural logarithm (ln)

Function

ln

result = ln(x)

Description

ln(x) is the natural logarithm of the elements of x. x can be any size or type. For complex variables, the complex natural log is used: ln(z)=ln(abs(z))+i*atan2(y,x), where z = x + y*i. ln(0) is undefined.

Note: ln(x)/ln(10)=log10(x).

Input

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Output

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

See also

Log base 2 (log2)

Log base 10 (log10)


Not equal to relational operator
Not equal to (!=) relational operator

Operator

!=

Description

The != operator returns "true" (value = 1) whenever the two operands are different; otherwise it returns "false" (value = 0) denoting that both operands are the same. Complex numbers are compared on the basis of magnitude.

Example

out0 = 3!=4   // evaluates to 1


Pi

Function

pi

result = pi()

Description

Returns the value of pi (= 3.1421593 . . .) to machine accuracy.

Input/Output

Input: none.

Output: 3.141593.


Real part (re)

Function

re

result = re(x)

Description

Returns the real part of an input variable. If the number is real, re(x)=x.

Input

Scalar	Vector	Array

REAL	    X	    X	   X

COMPLEX	    X	    X	   X

Output

Scalar	Vector	Array

REAL	    X	     X        X

COMPLEX

See also

Imaginary part (im)


Rows

Function

rows

result = rows(A)

Description

Returns the number of rows in a given matrix/array.

Input

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Output

Scalar	Vector	Array

REAL	    X

COMPLEX

See also

Columns (cols)


Secant (sec)

Function

sec

result = sec(x)

Description

sec(x) returns a matrix equivalent in size to x containing the secant (1/cos(x)) of the elements of x (in radians).

Input

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Output

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

See also

Arc/inverse secant (asec, asech)

Hyperbolic secant (sech)


Semicolon

Operator

;

Description

Separates rows/columns in indexing and denotes a dimension separator for array creation.

Examples

A = { 1, 2 ; 3, 4 ; 5, 6 }

x = A[0, 1; 0]	// x = the 1st element from the 1st

// and 2nd rows of matrix A


Signum (sign)

Function

sign

result = sign(x)

Description

Returns the signum of the input variable. If the input is zero, sign(x) returns a zero. If x is positive (i.e. x>0), sign(x) returns 1, if x is negative (i.e. x<0), sign(x)returns –1. If x is complex, sign(x) = x/abs(x).

Input

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Output

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

See also

Floor

Ceiling (ceil)


Sine (sin)

Function

sin

result = sin(x)

Description

sin(x) returns a matrix equivalent in size to x containing the sine of the elements of x (in radians).

Input

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Output

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

See also

Arc/inverse sine (asin, asinh)

Hyperbolic sine (sinh)


Square root (sqrt)

Function

sqrt

result = sqrt(x)

Description

Returns the square root or 1/2 power of an input variable. x can be any size or type, but sqrt(x) is performed on an element-by-element basis.

Note: sqrt(x) is essentially an extension of the .^ (array power) operator and can be written as such.

Input

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Output

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X


Tangent (tan)

Function

tan

result = tan(x)

Description

tan(x) returns a matrix equivalent in size to x containing the tangent (sin(x)/cos(x)) of the elements of x (in radians).

Input

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Output

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

See also

Arc/inverse tangent (atan, atanh)

Hyberbolic tangent (tanh)


Time

Function

time

result = time()

Description

time() returns the number of seconds since January 1, 1980.

Input

Scalar	Vector	Array

REAL

COMPLEX

Output

Scalar	Vector	Array

REAL	    X

COMPLEX


Truncate (trunc)

Function

trunc

result = trunc(x)

Description

Truncates all digits of x after the decimal point, essentially rounding it towards zero. For complex input, real and imaginary parts are truncated individually.

Input

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Output

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Example

q[3;3] =

    1.7165     0.6596     0.3716

    0.5201     1.3280     2.6121

    2.1253     0.8646     1.0044

trunc(q)

answer [3;3] =

    1.0000     0.0000     0.0000

    0.0000     1.0000     2.0000

    2.0000     0.0000     1.0000

See also

ceiling (ceil)

floor

signum (sign)


Round

Function

round

result = round(x)

Description

Rounds the elements of x to the closest integer. Input variable may be real or complex. If the variable is complex, real and imaginary parts are rounded separately.

Input

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Output

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Example

x[1;4] =

    0.5403    -0.4161    -0.9900    -0.6536

floor(x)

answer [1;4] =

    1.0000     0.0000    -1.0000    -1.0000

See also

floor

ceiling (ceil)


Modulus (mod)

Function

mod

result = mod(x,y)

Description

Returns the remainder (or modulus) left over when x is divided by y. Same as rem(x,y). For complex input, the imaginary parts are disregarded. Both x and y must be the same size or one must be a scalar.

Input X

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Input Y

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX	    X	    X	    X

Output

Scalar	Vector	Array

REAL	    X	    X	    X

COMPLEX

Example

a[1;3] =

    1.4000     5.6000    22.1000

b[1;3] =

    1.0000     2.0000     3.0000

mod(a,b)

answer [1;3] =

    0.4000     1.6000     1.1000


Are MathConnex models reusable?

Yes!  Systems constructed in MathConnex™ can be added to the module library, allowing you to incorporate them into other systems in other projects. For example, you may create a model of a system for solving a specific class of linear equations. By placing that model in the module library, the "equation solver" can be used in other systems as required. In this way, you can build up a set of pre-built systems or subsystems which can not only be used in your own personal MathConnex projects, but can be shared with colleagues working on similar problem sets. Libraries of user-built modules will further enhance the speed with which you can model mathematical systems.


Introduction contents
What is MathConnex?

How would I use MathConnex?

Are MathConnex models reusable?

Does MathConnex provide pre-built visual components?

Does MathConnex provide file I/O capabilities?


Does MathConnex provide file I/O capabilities?

Yes!  MathConnex™ can read from a variety of file types including ASCII Text files, Excel files, and MATLAB files.


Does MathConnex provide pre-built visual components?

Yes!  MathConnex™ provides 16 visual components as well as pre-built modules. Use the visual components to:

	Input a constant or range of values Inspect data values in a mini-spreadsheet Graph two-dimensional data from multiple sources Program using the ConnexScript™ language Perform mathematical computations using Mathcad Connect to an Excel worksheet Create three and two-dimensional graphs using Axum Program using the MATLAB® language
	Pause or stop a running system on input Break (interrupt) data flow along the wire Gather initial and subsequent data Conditionally route data Generate a series of values Enter text directly on the worksheet for annotation Use a variable to refer to a set of data Read or write data from or to a file


How would I use MathConnex?

Given the variety of components available for integration into a system, you can use MathConnex to design an endless number of different systems involving different applications and data sources. For example, you can use MathConnex to:

•	Integrate Mathcad with other applications such as Excel and MATLAB.

•	Chain Mathcad worksheets together and pass data from one to the next.

•	Break a large Mathcad worksheet into several smaller worksheets and connect them in MathConnex. Use conditionals to control the flow from one to another.

•	Loop through a Mathcad worksheet by passing the output from a worksheet into itself as input.

•	Facilitate the development of a large project: break it up into subsections, design each as a MathConnex module, and assemble them into a MathConnex project.


What is MathConnex?

MathConnexª is an environment for visually integrating applications and data sources to control projects involving a variety of applications and data sources. By providing a choice of 16 visual components for each data source or application in a system—such as a Mathcad component, an Excel component, and a File Read/Write component—MathConnex lets you manage the flow of data from one application or data source to another. You can easily create a system consisting of Mathcad worksheets, other applications, and data sources by:

•	Dragging components from a component palette and dropping them into your worksheet.

•	Wiring the components together to indicate data flow.

•	Simulating the system using toolbar controls to run through the system.


Oing to this page is a macro link to

Creating_a_graph___Axes


this page is a macro link to

Creating_a_graph___Labels


this page is a macro link to

Creating_a_graph (plot page)


this page is a macro link to

Line__Styles


this page is a macro link to

Range_checking


this page is a macro link to

locking_a_subsystem


MathConnex workspace contents
Components

Explorer

MathConnex menus

MathConnex workspace

Modules

Projects

Status Bar

Toolbar

Worksheet


Edit menu

Undo	Undo the last command.
Redo	Redo the last command.
Cut	Remove the selected object(s) from the Worksheet and place in the Clipboard.
Copy	Send a copy of the selected object(s) to the Clipboard.
Paste	Insert the contents of the Clipboard into the Worksheet.
Object...	Activate embedded or linked OLE object in the Worksheet.


Help menu

MathConnex Help...	Show MathConnex Help topics.
Tip of the Day...	Display tips for using MathConnex.
About MathConnex...	Display program information, version number, and copyright.


Insert menu

Component…	Launch Wizard to insert component into the Worksheet.
Object…	Insert OLE object into the Worksheet.
Scripted Object…	Launch Scripting Wizard to insert a Scripted Object component into the Worksheet.


Explorer
MathConnex Explorer

The MathConnex Explorer is an object browser you see in the Worksheet. It can display:

a project's contents in a hierarchical view.

available modules in a hierachical view.

available system components in a hierarchical view.

The MathConnex Explorer has separate Project, Modules, and Components tabs.


Explorer Project tab
MathConnex Explorer: Project tab

The Project tab in the MathConnex Explorer displays an expandable tree diagram of the Project showing:

the components placed in the Worksheet

collapsed system(s) in the Worksheet

To display a project's contents:
     Click the plus sign ( + ) next to the Project folder icon.

To remove the component currently highlighted in the tree diagram from the Worksheet:
     Select Cut from the Edit menu, press Ctrl+X, or press the Del key.

To close a tree diagram:
     Click the minus sign ( - ).

See also

MathConnex Explorer

MathConnex Explorer: Modules tab

MathConnex Explorer: Components tab


Explorer Modules tab
MathConnex Explorer: Modules tab

The Modules tab in the MathConnex Explorer displays a list of module folders containing modules available for embedding in a worksheet.

To display the list of modules:
Click the plus sign ( + ) next to the Modules folder icon.

To close the modules tree diagram:
Click the minus sign ( - ) next to the Modules folder icon.

See also

Modules

MathConnex Explorer

MathConnex Explorer: Project tab

MathConnex Explorer: Components tab


Explorer Components tab
MathConnex Explorer: Components tab

The Components tab in the Explorer displays a list of folders containing components available for embedding in a worksheet. MathConnex initially lists the same set of components available from the Component Palettes. Other components you later install appear here. Contact MathSoft or visit the MathSoft Web site for information about the availability of new components.

To display the list of components:
Click the plus sign ( + ) next to the Components folder icon.

To close the Components tree diagram:
Click the minus sign ( - ) next to the Components folder icon.

To add a component to the Worksheet:
1. Click on the component name or icon in the component tree.
2. While holding down the mouse button, drag the component icon to the Worksheet.

See also

MathConnex Explorer

MathConnex Explorer: Project tab

MathConnex Explorer: Modules tab


Edit menu

Undo	Undo the last command.
Redo	Redo the last command.
Cut	Remove the selected object(s) from the Worksheet and place them in the Clipboard.
Copy	Send a copy of the selected object(s) to the Clipboard.
Paste	Insert the contents of the Clipboard into the Worksheet.
Object...	Activate embedded or linked object.


File menu

New	Begin a new MathConnex project.
Open...	Open an existing MathConnex project.
Save	Save a MathConnex project.
Save As...	Save a MathConnex project to a different filename.
Print Setup...	Define the properties for printing a project.
Print Preview	Display a replica of what the project will look like when it is printed.
Print...	Print the active project.
Send...	Attach a copy of the current project to an e-mail message. The recipient of the e-mail must have properly installed MathConnex software in order to view the Worksheet.
Recent Files	Open most recently saved MathConnex projects.
Exit	Close MathConnex.


ConnexScript language

ConnexScript is a lightweight programming language you use in the ConnexScript and Conditional components of MathConnex. It provides basic scientific calculator functionality and is useful for computational flow control in cases where you don’t need the full functionality of the Mathcad, Excel, or MATLAB component.

ConnexScript has a familiar mathematical syntax which is similar to that in other popular matrix language products. In addition, many mathematical operators, such as matrix multiplication and division, are built into the language, as are basic and user-defined mathematical functions.

ConnexScript supports:

basic mathematical functions that operate on both real and complex data

user-defined functions

conditional statements

loop statements

array indexing operators

ConnexScript can be used in MathConnex:

to embed computations in a ConnexScript component

to define conditions in the Conditional component


Projects

Each system you design in the MathConnex workspace is considered a project.

As you are building a project, the tree diagram in the MathConnex Explorer’s Project tab expands to show the components contained in the system.

A project can be:

saved to disk as a document (file) with the file extension .MXP.

saved as a module to be reused later in other systems.

printed

sent by electronic mail

copied by saving it to a different filename, but still with the filename extension .MXP.

See also

Worksheet

Modules


Run menu

Run	Run the system(s) contained in the Worksheet.
Pause	Pause a running system.
Step	Run the next component connected in the Worksheet.
Stop	Stop a running or paused system.
Single Step Mode	Toggle the execution of parallel systems to be sequential or concurrent.
Highlight Components	Toggle the highlighting of the component currently being calculated during the run.


Modules

A module is a MathConnex component or system that has been tailored or customized and then saved "as is" for reuse in other MathConnex systems. Any system component or group of components can be stored as a reusable Module.

For example, you may wish to configure a Graph component with preferred font and color settings and then save it as a module. Now, whenever you need a Graph component, you can select your customized graph from the Modules tab in the MathConnex Explorer, rather than having to select a Graph component from the Component Palettes and then reconfigure it to your preferred settings each time.

When you drag and drop a module into the Worksheet, you are working with just a copy of the Module, so you can modify and save it later as a different module if desired.

See also

Adding a module to the Worksheet

Drag and drop modules

Exporting modules

Importing modules

Moving a module within the Explorer

Naming a module

Navigating through the Explorer

Saving a component as a module

Saving a system as a module

Module properties page


Available Components

Built-in components are available in the Component Palettes in the MathConnex workspace or from the Components tab  in the MathConnex Explorer.

Components to generate, import, or export data

	Input	Input a single value or an array in a scrollable table.
	File Read or Write	Input data from or output data to or from a file.
	Ramp	Generate a sequence of regularly spaced values.
	Global Variable	Input a value accessible by any component in the system.
Components for viewing results

	Inspector	Inspect data values in a scrollable table.
	Graph	Two-dimensional data from multiple sources.
	Axum	Display an Axum 2D or 3D plot, if Axum is installed on your system.

Computational components

	Mathcad	Compute with Mathcad.
	Excel	Compute with Excel, if installed on your system.
	MATLAB	Compute with MATLAB, if installed on your system.
	ConnexScript	Compute using commands in the ConnexScript language.
Components for controlling data flow

	Conditional	Conditionally route data to output ports.
	Initialize	Take initial value from one input port and subsequent values from another.
	Wire Breaker	Break (interrupt) data flow along the wire.
	Stop or Pause	Pause or stop running a system on input.
Other components

	Text	Enter text directly on the Worksheet for annotation.

Tip	You can move the Component Palettes to a different location on the workspace or remove them using commands on the View menu.


Status Bar

The Status Bar at the bottom of the MathConnex window describes the current operation whenever you select a menu command. Look in the right-hand portion of the Status Bar to see the run mode of the system you have on the worksheet:

RUN—the system is currently running.

PAUSE—execution has been paused.

STOP— execution has been stopped.

See also

Toolbar

MathConnex menus


Toolbar

The MathConnex Toolbar contains buttons for shortcut access to commonly used commands.

	New	Open blank Worksheet for a new MathConnex project.
	Open	Open an existing MathConnex project.
	Save	Save file.
	Print	Print the active project.
	Print Preview	Preview what the project will look like when it’s printed.
	Cut	Remove the selected object(s) and place them in the Clipboard.
	Copy	Copy the selected object(s) to the Clipboard.
	Paste	Insert the contents of the Clipboard into the Worksheet.
	Run	Run the system contained in the Worksheet.
	Pause	Pause a running system.
	Step	Run the next component connected in the Worksheet.
	Stop	Stop a running or paused system.
	Back	Go to a higher-level worksheet.
	Zoom In	Increase the scale of the Worksheet.
	Zoom Out	Decrease the scale of the Worksheet.
	Help	Show MathConnex Help topics.
See also

MathConnex menus


View menu

Toolbar	Toggle the display of the Toolbar.
Status Bar	Toggle the display of the Status Bar.
Explorer	Toggle the display of the Explorer.
Component Palette 1	Toggle the display of eight built-in component buttons.
Component Palette 2	Toggle the display of eight built-in component buttons.
Go Back	Go to higher level of Worksheet when a collapsed subsystem is being viewed.
Zoom In	Increase the scale of the Worksheet display to magnify the objects on the Worksheet.
Zoom Out	Decrease the scale of the Worksheet display to reduce the size of the objects on the Worksheet.
Show Labels	Toggle the display of labels on components in the Worksheet.


MathConnex menus

File menu

New	Begin a new MathConnex project.
Open...	Open an existing MathConnex project.
Save	Save a MathConnex project.
Save As...	Save a MathConnex project to a different filename.
Print Setup...	Define the properties for printing a project.
Print Preview	Display a replica of what the project will look like when it is printed.
Print...	Print the active project.
Send...	Attach a copy of the current project to an e-mail message. The recipient of the e-mail must have properly installed MathConnex software in order to view the Worksheet.
Recent Files	Open most recently saved MathConnex projects.
Exit	Close MathConnex.

Edit menu

Undo	Undo the last command.
Redo	Redo the last command.
Cut	Remove the selected object(s) from the Worksheet and place them in the Clipboard.
Copy	Send a copy of the selected object(s) to the Clipboard.
Paste	Insert the contents of the Clipboard into the Worksheet.
Object...	Activate embedded or linked object.
View menu

Toolbar	Toggle the display of the Toolbar.
Status Bar	Toggle the display of the Status Bar.
Explorer	Toggle the display of the Explorer.
Component Palette 1	Toggle the display of eight built-in component buttons.
Component Palette 2	Toggle the display of eight built-in component buttons.
Go Back	Go to higher level of Worksheet when a collapsed subsystem is being viewed.
Zoom In	Increase the scale of the Worksheet display to magnify the objects on the Worksheet.
Zoom Out	Decrease the scale of the Worksheet display to reduce the size of the objects on the Worksheet.
Show Labels	Toggle the display of labels on components in the Worksheet.

Insert menu

Component…	Launch Wizard to insert component into the Worksheet.
Object…	Insert OLE object into the Worksheet.
Scripted Object…	Launch Scripting Wizard to insert a Scripted Object Component into the Worksheet.
Run menu

Run	Run the system(s) contained in the Worksheet.
Pause	Pause a running system.
Step	Run the next component connected in the Worksheet.
Stop	Stop a running or paused system.
Single Step Mode	Toggle the execution of parallel systems to be sequential or concurrent.
Highlight Components	Toggle the highlighting of the component currently being calculated during the run.

Help menu

MathConnex Help...	Show MathConnex Help topics.
Tip of the Day...	Display tips for using MathConnex.
About MathConnex...	Display program information, version number, and copyright.
See also

Toolbar


MathConnex workspace

The MathConnex workspace includes several named areas, some of which are resizable and dockable:

MathConnex menus

Toolbar: resizable and dockable

MathConnex Explorer: resizable and dockable

Component Palettes: resizable and dockable

Worksheet

Status Bar

Tip	Commands in the View menu allow you to choose to display all or some of the areas in the MathConnex workspace.


Worksheet

In the Worksheet area of the MathConnex workspace, you design, run, analyze, and edit MathConnex systems.

Example of a
Worksheet

You can do the following:

zoom in and out on the areas of the Worksheet

scroll to view a different part of the Worksheet

print preview the system contained in the Worksheet

print the system contained in the Worksheet

attach a copy of the Worksheet to an e-mail message

collapse part of a system into a subsystem

embed the Worksheet in another application's document


Scripted Object component

You can exchange data between MathConnex components and any object that supports OLE2 Automation, even if MathConnex does not have a specific component to do so. You use the Scripted Object component to write a custom script (or program) for an object so that it behaves just like any other component:

Accepts values from MathConnex components that are wired to its input port(s).

Activates the server application or control to manipulate the data when the MathConnex system is running.

Sends values to MathConnex components wired to its output port(s).

For example, you may want to design a MathConnex system in which components send data to a Lotus 1-2-3 worksheet, where the data are transformed and output to other MathConnex components in the system.

Unlike other OLE objects you insert into the Worksheet, however, a Scripted Object component displays input and output ports and can pass data in a MathConnex system.

To create a Scripted Object component, you must:

Be proficient in a supported scripting language, such as Microsoft VBScript or JScript, that is installed on your system.

Understand the way the OLE server, OLE control, or ActiveX control that you are trying to script has implemented OLE Automation.

Have the server or control available on your system.

Understand the object model for the Scripted Object component.

Then you can:

1. Insert the Scripted Object component.

2. Script the object.

See also

Scripted Object properties

Adding input or output ports

Labeling components

Resizing a component

Viewing a component as an icon

Viewing a component as an object

Wiring components


Scripting languages

Before you insert a Scripted Object component into the MathConnex Worksheet, you need to have a supported scripting language installed on your system. The following are among the supported scripting languages:

Microsoft VBScript (Visual Basic Scripting Edition) version 2

Microsoft JScript (an implementation of JavaScript) version 2

Both of these scripting languages can currently be downloaded at no charge from Microsoft, Inc.’s Web sites:

http://www.microsoft.com/vbscript

http://www.microsoft.com/jscript

Refer to the above Web sites for more information regarding the syntax and techniques used in Microsoft VBScript and JScript. Or, if you use another supported scripting language, refer to documentation provided by its designer.

See also

Inserting the Scripted Object component

Scripting an object

Scripted Object component model

Scripted Object properties


VBScript

VBScript is a strict subset of the Visual Basic for Applications language used in Microsoft Excel, Project, Access, and the Visual Basic 4.0 development system. VBScript is designed to be a lightweight interpreted language, so it does not use strict types (only Variants). Also, because VBScript is intended to be a safe subset of the language, it does not include file input/output or direct access to the underlying operating system.


Jscript

JScript is a fast, portable, lightweight interpreter for use in applications that use ActiveX Controls, OLE automation servers, and Java applets. JScript is directly comparable to VBScript (not Java). Like VBScript, JScript is a pure interpreter that processes source code rather than producing stand-alone applets.


Inserting the Scripted Object component

To insert a Scripted Object component into the MathConnex Worksheet:

1. Make sure you have a supported scripting language installed on your system.

2. Choose Scripted Object from the Insert menu.

This launches the Scripting Wizard. Specify the OLE server, OLE control, or ActiveX control from which you want to create a Scripted Object. The Object to Script scrolling list shows available objects on your system. Choose an object that supports the OLE2 Automation interface.

The fact that an object appears on the Object to Script scrolling list does not necessarily indicate that it supports the OLE2 automation interface to work as a Scripted Object in MathConnex. You’ll need to consult the documentation for any OLE server, OLE control, or ActiveX control you script in MathConnex.

You must specify:

Whether the object will be a new file or whether you will insert a file that already exists.

Whether you will see a viewport on the file in the MathConnex Worksheet or whether you’ll see an icon.

3. When you click the “Next” button, the Wizard brings you through other dialog boxes where you specify:

Which scripting language you will use.

The name by which you will refer to the object in your script.

The number of input and output ports the object will have.

See also

Scripting the object

Scripted Object properties

Scripted Object component model


Scripted Object component model

The Scripted Object component has the following predefined objects, properties, and methods that enable you to configure it to work as a MathConnex component.

Collections

Inputs and Outputs are predefined collections of DataValue objects (see below) containing the Scripted Object’s inputs and the outputs, respectively.

The Count property can be used to query the total number of elements in the collection. For example, Outputs.Count returns the number of output ports.

The Item method is used to specify an individual element in the collection. To refer to a particular input or output, use the notation Inputs.Item(n) or Outputs.Item(n), where n is the index of the input or output. The index n always starts from 0. Since Item is the default method, languages such as VBScript and JScript let you drop the method name to imply the default method. For example, Inputs(0) is equivalent to Inputs.Item(0) and references the first input.

DataValue objects

The Value property accesses a DataValue’s real part. For example, in VBScript or JScript Inputs(0).Value returns the real part of the first input.

The IValue property accesses a DataValue’s imaginary part. For example, in VBScript or JScript Outputs(1).IValue returns the imaginary part of the second output. If there is no imaginary part, the IValue portion returns “NIL.”

The IsComplex property returns TRUE if a DataValue has a valid imaginary part; this property returns FALSE otherwise. For example, if (inputs(0).IsComplex) returns FALSE if the first input has only a real part.

The Rows and Cols properties yield the number of rows and columns.

Global methods

The alert function takes a single string parameter that is presented to the user as a standard modal Windows message box with an “OK” button.

The errmsg function takes a single string parameter as its first argument that displays as an error message from within the script and causes the script to stop execution. The second parameter is also a string but it is optional. It is used to display the source of the error.

Note: In JScript, the names of functions, methods, objects, and properties are case sensitive, while in VBScript they are not.

See also

Scripting the object

Inserting the Scripted Object component

Scripted Object properties

Supported scripting languages


Scripting an object

After you insert a Scripted Object component, you can start scripting it:

1. Click once on the component with the right mouse button to see the context menu.

2. Choose Edit Script from the context menu.

You’ll see a new window called the Script Editor containing three subroutine stubs in which you insert your own scripting code. What you will include in these subroutines is determined largely by the properties of the OLE object you are scripting; consult the documentation for the server or control.

3. When you have finished writing your script, choose Close and Return from the Script Editor’s File menu, or press Esc.

For examples of Scripted Object components with working scripts, see the samples folder in the location where you installed Mathcad and MathConnex. Bear in mind that to run these sample projects with Scripted Object components, you will need to install any applications or controls that were used to create those components.

See also

Inserting the Scripted Object component

Supported scripting languages

Scripted Object properties

Scripted Object component model


A starting routine, called once when execution of the system begins. This is a good place to initialize variables, open files for reading and writing, etc.

An execution routine, called every time the component receives or outputs data values. By default it takes as arguments the collections Inputs and Outputs.

A stopping routine, called once when execution of the system stops.