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