idamnjanovic@60: /************************************************************************** idamnjanovic@60: * idamnjanovic@60: * File name: mexutils.h idamnjanovic@60: * idamnjanovic@60: * Ron Rubinstein idamnjanovic@60: * Computer Science Department idamnjanovic@60: * Technion, Haifa 32000 Israel idamnjanovic@60: * ronrubin@cs idamnjanovic@60: * idamnjanovic@60: * Last Updated: 18.8.2009 idamnjanovic@60: * idamnjanovic@60: * Utility functions for MEX files. idamnjanovic@60: * idamnjanovic@60: *************************************************************************/ idamnjanovic@60: idamnjanovic@60: idamnjanovic@60: #ifndef __MEX_UTILS_H__ idamnjanovic@60: #define __MEX_UTILS_H__ idamnjanovic@60: idamnjanovic@60: #include "mex.h" idamnjanovic@60: idamnjanovic@60: idamnjanovic@60: idamnjanovic@60: /************************************************************************** idamnjanovic@60: * Function checkmatrix: idamnjanovic@60: * idamnjanovic@60: * Verify that the specified mxArray is real, of type double, and has idamnjanovic@60: * no more than two dimensions. If not, an error message is printed idamnjanovic@60: * and the mex file terminates. idamnjanovic@60: * idamnjanovic@60: * Parameters: idamnjanovic@60: * param - the mxArray to be checked idamnjanovic@60: * fname - the name of the function where the error occured (15 characters or less) idamnjanovic@60: * pname - the name of the parameter (25 characters or less) idamnjanovic@60: * idamnjanovic@60: **************************************************************************/ idamnjanovic@60: void checkmatrix(const mxArray *param, char *fname, char *pname); idamnjanovic@60: idamnjanovic@60: idamnjanovic@60: /************************************************************************** idamnjanovic@60: * Function checkvector: idamnjanovic@60: * idamnjanovic@60: * Verify that the specified mxArray is 1-D, real, and of type double. The idamnjanovic@60: * vector may be a column or row vector. Otherwise, an error message is idamnjanovic@60: * printed and the mex file terminates. idamnjanovic@60: * idamnjanovic@60: * Parameters: idamnjanovic@60: * param - the mxArray to be checked idamnjanovic@60: * fname - the name of the function where the error occured (15 characters or less) idamnjanovic@60: * pname - the name of the parameter (25 characters or less) idamnjanovic@60: * idamnjanovic@60: **************************************************************************/ idamnjanovic@60: void checkvector(const mxArray *param, char *fname, char *pname); idamnjanovic@60: idamnjanovic@60: idamnjanovic@60: /************************************************************************** idamnjanovic@60: * Function checkscalar: idamnjanovic@60: * idamnjanovic@60: * Verify that the specified mxArray represents a real double scalar value. idamnjanovic@60: * If not, an error message is printed and the mex file terminates. idamnjanovic@60: * idamnjanovic@60: * Parameters: idamnjanovic@60: * param - the mxArray to be checked idamnjanovic@60: * fname - the name of the function where the error occured (15 characters or less) idamnjanovic@60: * pname - the name of the parameter (25 characters or less) idamnjanovic@60: * idamnjanovic@60: **************************************************************************/ idamnjanovic@60: void checkscalar(const mxArray *param, char *fname, char *pname); idamnjanovic@60: idamnjanovic@60: idamnjanovic@60: /************************************************************************** idamnjanovic@60: * Function checksparse: idamnjanovic@60: * idamnjanovic@60: * Verify that the specified mxArray contains a sparse matrix. If not, idamnjanovic@60: * an error message is printed and the mex file terminates. idamnjanovic@60: * idamnjanovic@60: * Parameters: idamnjanovic@60: * param - the mxArray to be checked idamnjanovic@60: * fname - the name of the function where the error occured (15 characters or less) idamnjanovic@60: * pname - the name of the parameter (25 characters or less) idamnjanovic@60: * idamnjanovic@60: **************************************************************************/ idamnjanovic@60: void checksparse(const mxArray *param, char *fname, char *pname); idamnjanovic@60: idamnjanovic@60: idamnjanovic@60: /************************************************************************** idamnjanovic@60: * Function checkcell_1d: idamnjanovic@60: * idamnjanovic@60: * Verify that the specified mxArray is a 1-D cell array. The cell array idamnjanovic@60: * may be arranged as either a column or a row. If not, an error message idamnjanovic@60: * is printed and the mex file terminates. idamnjanovic@60: * idamnjanovic@60: * Parameters: idamnjanovic@60: * param - the mxArray to be checked idamnjanovic@60: * fname - the name of the function where the error occured (15 characters or less) idamnjanovic@60: * pname - the name of the parameter (25 characters or less) idamnjanovic@60: * idamnjanovic@60: **************************************************************************/ idamnjanovic@60: void checkcell_1d(const mxArray *param, char *fname, char *pname); idamnjanovic@60: idamnjanovic@60: idamnjanovic@60: #endif idamnjanovic@60: