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