/* Pass analyze_cell a pointer to a cell mxArray. Each element in a cell mxArray is called a "cell"; each cell holds zero or one mxArray. analyze_cell accesses each cell and displays information about it. */ static void analyze_cell(const mxArray *cell_array_ptr) { int total_num_of_cells; int index; const mxArray *cell_element_ptr; total_num_of_cells = mxGetNumberOfElements(cell_array_ptr); mexPrintf("total num of cells = %d\n", total_num_of_cells); mexPrintf("\n"); /* Each cell mxArray contains m-by-n cells; Each of these cells is an mxArray. */ for (index=0; index<total_num_of_cells; index++) { mexPrintf("\n\n\t\tCell Element: "); display_subscript(cell_array_ptr, index); mexPrintf("\n"); cell_element_ptr = mxGetCell(cell_array_ptr, index); if (cell_element_ptr == NULL) mexPrintf("\tEmpty Cell\n"); else { /* Display a top banner. */ mexPrintf("------------------------------------------------\n"); get_characteristics(cell_element_ptr); analyze_class(cell_element_ptr); mexPrintf("\n"); } } mexPrintf("\n"); }
/* mexFunction is the gateway routine for the MEX-file. */ void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) { int i; (void) nlhs; /* unused parameters */ (void) plhs; /* Check to see if we are on a platform that does not support the compatibility layer. */ #if defined(_LP64) || defined (_WIN64) #ifdef MX_COMPAT_32 for (i=0; i<nrhs; i++) { if (mxIsSparse(prhs[i])) { mexErrMsgIdAndTxt("MATLAB:explore:NoSparseCompat", "MEX-files compiled on a 64-bit platform that use sparse array functions need to be compiled using -largeArrayDims."); } } #endif #endif /* Look at each input (right-hand-side) argument. */ for (i=0; i<nrhs; i++) { mexPrintf("\n\n"); /* Display a top banner. */ mexPrintf("------------------------------------------------\n"); /* Display which argument */ mexPrintf("Name: %s%d%c\n", "prhs[",i,']'); get_characteristics(prhs[i]); analyze_class(prhs[i]); } }
void exploreMexArgs(int nargs, const mxArray *args[] ) { for (int i=0; i<nargs; i++) { mexPrintf("\n\n"); mexPrintf("Name: %s%d%c\n", "arg[",i,"]"); get_characteristics(args[i]); analyze_class(args[i]); } }
/* mexFunction is the gateway routine for the MEX-file. */ void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) { int i; /* Look at each input (right-hand-side) argument. */ for (i=0; i<nrhs; i++) { mexPrintf("\n\n"); get_characteristics(prhs[i]); analyze_class(prhs[i]); } }
/* mexFunction is the gateway routine for the MEX-file. */ void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) { int i; /* Look at each input (right-hand-side) argument. */ for (i=0; i<nrhs; i++) { mexPrintf("\n\n"); /* Display a top banner. */ mexPrintf("------------------------------------------------\n"); /* Display which argument */ mexPrintf("Name: %s%d%c\n", "prhs[",i,']'); get_characteristics(prhs[i]); analyze_class(prhs[i]); } }
/* Pass analyze_structure a pointer to a structure mxArray. Each element in a structure mxArray holds one or more fields; each field holds zero or one mxArray. analyze_structure accesses every field of every element and displays information about it. */ static void analyze_structure(const mxArray *structure_array_ptr) { mwSize total_num_of_elements; mwIndex index; int number_of_fields, field_index; const char *field_name; const mxArray *field_array_ptr; mexPrintf("\n"); total_num_of_elements = mxGetNumberOfElements(structure_array_ptr); number_of_fields = mxGetNumberOfFields(structure_array_ptr); /* Walk through each structure element. */ for (index=0; index<total_num_of_elements; index++) { /* For the given index, walk through each field. */ for (field_index=0; field_index<number_of_fields; field_index++) { mexPrintf("\n\t\t"); display_subscript(structure_array_ptr, index); field_name = mxGetFieldNameByNumber(structure_array_ptr, field_index); mexPrintf(".%s\n", field_name); field_array_ptr = mxGetFieldByNumber(structure_array_ptr, index, field_index); if (field_array_ptr == NULL) { mexPrintf("\tEmpty Field\n"); } else { /* Display a top banner. */ mexPrintf("------------------------------------------------\n"); get_characteristics(field_array_ptr); analyze_class(field_array_ptr); mexPrintf("\n"); } } mexPrintf("\n\n"); } }
//Clears PE characteristics flag void pe_properties::clear_characteristics_flags(uint16_t flags) { set_characteristics(get_characteristics() & ~flags); }
//Sets PE characteristics flag void pe_properties::set_characteristics_flags(uint16_t flags) { set_characteristics(get_characteristics() | flags); }