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