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