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