00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "mex.h"
00016
00017 void
00018 mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
00019 {
00020 mxArray *cell_array_ptr, *rhs[1];
00021 mwIndex i;
00022
00023 (void)plhs;
00024
00025
00026 if (nrhs < 1) {
00027 mexErrMsgTxt("At least one input argument required.");
00028 }
00029 if(nlhs > 1){
00030 mexErrMsgTxt("Too many output arguments.");
00031 }
00032
00033
00034 cell_array_ptr = mxCreateCellMatrix((mwSize)nrhs,1);
00035
00036
00037 for( i=0; i<(mwIndex)nrhs; i++){
00038 mxSetCell(cell_array_ptr,i,mxDuplicateArray(prhs[i]));
00039 }
00040
00041 rhs[0] = cell_array_ptr;
00042
00043
00044 mexPrintf("\nThe contents of the created cell is:\n\n");
00045 mexCallMATLAB(0,NULL,1,rhs,"disp");
00046 }
00047