| RESPITE: The CASA Toolkit Page: Documentation: Block Library Index:MProcess |
The MProcess block allows MATLAB users to incorporate MATLAB code into a CTK system. This may be useful as it effectively allows users to tailor their own blocks in the case where there are no suitable blocks in the CTK inbuilt block library.
MProcess has two parameters. First, a string parameter, PROCESS, contains the piece of MATLAB script that is used for transforming the data arriving at the block's input sockets into the data to be sent to the output sockets. Within this script the input sockets are referred to as in1, in2 ... etc and the output sockets as out1, out2 ... etc. The second parameter, INITIALISE, contains any MATLAB code that is necessary to initialise the code contained in the PROCESS string each time the CTK system is to be run.
The number of inputs and outputs to the block is configured automatically to match the number of input and output sockets referred to in the INITIALISE and PROCESS strings.
As a simple example:
ADD integrate = MProcess(INITIALISE="x=0", PROCESS="x=x+in1; out1=x;")
this will make a block called integrate with one input and one output that integrates the signal arriving at the input.
It should be noted however that using MATLAB within a CTK system may severely reduce the speed at which the system runs. Its always preferable to use one or more inbuilt CTK blocks if possible. In the example above it would be far better to use the inbuilt CTK Integrator block.
BUG! The block will not run if INITIALISE is not set, even if no initialisation is needed. As a work-around, if no initialisation is required, give INITIALISE the value `0'.
| Inputs | Meaning | Sample | 1-D frame | |
|---|---|---|---|---|
| in1 | signal to process (channel 1) | Yes | Yes | Yes |
| ... | ... | Yes | Yes | Yes |
| in n | signal to process (channel n) | Yes | Yes | Yes |
| Outputs | Meaning |
|---|---|
| out1 | processed signal (channel 1) |
| ... | ... |
| out n | processed signal (channel n) |
| Parameters | Type | Default | Meaning |
|---|---|---|---|
| INITIALISE | String | - | MATLAB statements to perform initialisation |
| PROCESS | String | - | MATLAB statements to operate on input data |