Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Group: Information and Control
See also: endp

Function: proc
Description: defines a procedure with the input parameters and output parameters

Link:
Usage: proc (y) = pname(x)
Input:
pname name of the procedure
Output:
y output parameter
x input parameter

Note:

Example:
proc(y)=tran(x)
  y=x'
endp
v=1|1|1
p=tran(v)
p

Result:
The procedure tran is now defined with one input and one output parameter.  After calling this procedure, you get
following result:

Contents of p



[1,]        1        1        1
Example:
proc()=myproc()
  "BODY OF THE PROCEDURE"
endp
myproc()

Result:
The procedure is now defined, without any input or output parameter, after calling the procedure,
 using the command myproc(), you get the following output:

 Contents of _tmp



[1,] "BODY OF THE PROCEDURE"
Example:
proc(m,v)=desc(x)
  m=mean(x)
  v=var(x)
endp
randomize(0)
z=normal(100)
x=desc(z)
x.m
x.v
{a,b}=desc(z)
a
b

Result:
The first call of desc shows how the return values are stored in list x. The elements of the list
are named as the return parameters in the procedure definition of desc.
The second call of desc shows how the return values are directly assigned to matrices a and b.



(C) MD*TECH Method and Data Technologies, 05.02.2006