Product(s): | Cube |
Version(s): | 6.1 to 6.5 |
Area: | Matrix |
Cube Voyager Matrix program is a flexible calculator. It processes: matrices, zonal data, tables, or text records accordingly to user specified expressions.
When processing an input matrix (MATI) the Matrix program performs an implicit I-loop. The implicit ILOOP phase implies that the input matrix is processed row-by-row (I).
Loops over J (columns) need explicit coding using a JLOOP command:
JLOOP
...
ENDJLOOP
Therefore, if I want to do simple calculations with a Matrix program I need to consider these I-Loop and J-Loop accordingly. For example, if I want to set an entire row to 0, I just need to write a statement like:
MW[1]=MI.1.1 ; defining work matrix with index 1 to be = to the input matrix 1 - tab 1
IF (I=10)
MW[1]=0 ;this will set the entire row (i=10) to 0
ENDIF
If I want to process columns as well, I need to include a J-Loop. For example, if I want to set an entire column to 0, I just need to write a statement like:
MW[2]=MI.1.1 ; defining work matrix with index 2 to be = to the input matrix 1 - tab 1 JLOOP IF (J=10) MW[2]=0 ;this will set the entire column (j=10) to 0 ENDIF ENDJLOOP
This simple example on the difference between IMPLICIT I-LOOP and EXPLICIT J-LOOP is provided by the Matrix program in the catalog below, within the Matrix program #1 “Simple calculations example 1”.
Another simple example is provided in Matrix program #2 “Simple calculations example 2” of the attached ZIP data. Where: