ivan@137
|
1 /**************************************************************************
|
ivan@137
|
2 *
|
ivan@137
|
3 * File name: mexutils.h
|
ivan@137
|
4 *
|
ivan@137
|
5 * Ron Rubinstein
|
ivan@137
|
6 * Computer Science Department
|
ivan@137
|
7 * Technion, Haifa 32000 Israel
|
ivan@137
|
8 * ronrubin@cs
|
ivan@137
|
9 *
|
ivan@137
|
10 * Last Updated: 18.8.2009
|
ivan@137
|
11 *
|
ivan@137
|
12 * Utility functions for MEX files.
|
ivan@137
|
13 *
|
ivan@137
|
14 *************************************************************************/
|
ivan@137
|
15
|
ivan@137
|
16
|
ivan@137
|
17 #ifndef __MEX_UTILS_H__
|
ivan@137
|
18 #define __MEX_UTILS_H__
|
ivan@137
|
19
|
ivan@137
|
20 #include "mex.h"
|
ivan@137
|
21
|
ivan@137
|
22
|
ivan@137
|
23
|
ivan@137
|
24 /**************************************************************************
|
ivan@137
|
25 * Function checkmatrix:
|
ivan@137
|
26 *
|
ivan@137
|
27 * Verify that the specified mxArray is real, of type double, and has
|
ivan@137
|
28 * no more than two dimensions. If not, an error message is printed
|
ivan@137
|
29 * and the mex file terminates.
|
ivan@137
|
30 *
|
ivan@137
|
31 * Parameters:
|
ivan@137
|
32 * param - the mxArray to be checked
|
ivan@137
|
33 * fname - the name of the function where the error occured (15 characters or less)
|
ivan@137
|
34 * pname - the name of the parameter (25 characters or less)
|
ivan@137
|
35 *
|
ivan@137
|
36 **************************************************************************/
|
ivan@137
|
37 void checkmatrix(const mxArray *param, char *fname, char *pname);
|
ivan@137
|
38
|
ivan@137
|
39
|
ivan@137
|
40 /**************************************************************************
|
ivan@137
|
41 * Function checkvector:
|
ivan@137
|
42 *
|
ivan@137
|
43 * Verify that the specified mxArray is 1-D, real, and of type double. The
|
ivan@137
|
44 * vector may be a column or row vector. Otherwise, an error message is
|
ivan@137
|
45 * printed and the mex file terminates.
|
ivan@137
|
46 *
|
ivan@137
|
47 * Parameters:
|
ivan@137
|
48 * param - the mxArray to be checked
|
ivan@137
|
49 * fname - the name of the function where the error occured (15 characters or less)
|
ivan@137
|
50 * pname - the name of the parameter (25 characters or less)
|
ivan@137
|
51 *
|
ivan@137
|
52 **************************************************************************/
|
ivan@137
|
53 void checkvector(const mxArray *param, char *fname, char *pname);
|
ivan@137
|
54
|
ivan@137
|
55
|
ivan@137
|
56 /**************************************************************************
|
ivan@137
|
57 * Function checkscalar:
|
ivan@137
|
58 *
|
ivan@137
|
59 * Verify that the specified mxArray represents a real double scalar value.
|
ivan@137
|
60 * If not, an error message is printed and the mex file terminates.
|
ivan@137
|
61 *
|
ivan@137
|
62 * Parameters:
|
ivan@137
|
63 * param - the mxArray to be checked
|
ivan@137
|
64 * fname - the name of the function where the error occured (15 characters or less)
|
ivan@137
|
65 * pname - the name of the parameter (25 characters or less)
|
ivan@137
|
66 *
|
ivan@137
|
67 **************************************************************************/
|
ivan@137
|
68 void checkscalar(const mxArray *param, char *fname, char *pname);
|
ivan@137
|
69
|
ivan@137
|
70
|
ivan@137
|
71 /**************************************************************************
|
ivan@137
|
72 * Function checksparse:
|
ivan@137
|
73 *
|
ivan@137
|
74 * Verify that the specified mxArray contains a sparse matrix. If not,
|
ivan@137
|
75 * an error message is printed and the mex file terminates.
|
ivan@137
|
76 *
|
ivan@137
|
77 * Parameters:
|
ivan@137
|
78 * param - the mxArray to be checked
|
ivan@137
|
79 * fname - the name of the function where the error occured (15 characters or less)
|
ivan@137
|
80 * pname - the name of the parameter (25 characters or less)
|
ivan@137
|
81 *
|
ivan@137
|
82 **************************************************************************/
|
ivan@137
|
83 void checksparse(const mxArray *param, char *fname, char *pname);
|
ivan@137
|
84
|
ivan@137
|
85
|
ivan@137
|
86 /**************************************************************************
|
ivan@137
|
87 * Function checkcell_1d:
|
ivan@137
|
88 *
|
ivan@137
|
89 * Verify that the specified mxArray is a 1-D cell array. The cell array
|
ivan@137
|
90 * may be arranged as either a column or a row. If not, an error message
|
ivan@137
|
91 * is printed and the mex file terminates.
|
ivan@137
|
92 *
|
ivan@137
|
93 * Parameters:
|
ivan@137
|
94 * param - the mxArray to be checked
|
ivan@137
|
95 * fname - the name of the function where the error occured (15 characters or less)
|
ivan@137
|
96 * pname - the name of the parameter (25 characters or less)
|
ivan@137
|
97 *
|
ivan@137
|
98 **************************************************************************/
|
ivan@137
|
99 void checkcell_1d(const mxArray *param, char *fname, char *pname);
|
ivan@137
|
100
|
ivan@137
|
101
|
ivan@137
|
102 #endif
|
ivan@137
|
103
|