Contents Previous Next Subchapters

Number of Bytes Per Matrix Element
See Also: matrix

Prototype
int OMSize(enum type_mat mtype)

Description
The OMSize function returns an integer equal to the number of bytes required for each element of a matrix of type mtype where mtype is one of the O-Matrix types in the table below. If mtype is not one of those types, the OMSize function returns zero. (Note that each complex element corresponds to two double-precision values with the real part followed by the imaginary part.)

O-Matrix Types
enum type_mat pointer type meaning
LOGICAL_mat mbool logical
INT_mat mint integer
REAL_mat mreal real
DOUBLE_mat mdbl double-precision
COMPLEX_mat mdbl complex
CHAR_mat mchar character
Example
The following program is in the file omsize.c in the directory omwin\omdde. If you have the Microsoft Visual C++ compiler, it can be compiled and linked by executing the command
     nmake /f console.mak omsize.exe
in that directory.

# include <stdio.h>
# include "define\omdde.h"
# include "define\noserver.h"

int main()
{    
     int    ok;

     ok = OMDdeInitialize();
     if( ! ok )
     {    printf("Cannot initialize OMDDE\n");
          return 1;
     }

     printf("OMSize(LOGICAL_mat) = %d\n", OMSize(LOGICAL_mat));

     OMDdeUninitialize();
     return 0;
}