static real_T m_fprintf(const emlrtStack *sp, const char_T varargin_1_data[77], const int32_T varargin_1_size[2]) { const mxArray *y; static const int32_T iv136[2] = { 1, 7 }; const mxArray *m32; char_T cv168[7]; int32_T i; static const char_T cv169[7] = { 'f', 'p', 'r', 'i', 'n', 't', 'f' }; const mxArray *b_y; const mxArray *c_y; static const int32_T iv137[2] = { 1, 22 }; char_T cv170[22]; static const char_T cv171[22] = { 'M', 'A', 'C', '|', ' ', 'G', 'o', 't', ' ', 'm', 'e', 's', 's', 'a', 'g', 'e', ':', ' ', '%', 's', '\\', 'n' }; int32_T u_size[2]; int32_T i29; char_T u_data[77]; const mxArray *d_y; emlrtStack st; st.prev = sp; st.tls = sp->tls; y = NULL; m32 = mxCreateCharArray(2, iv136); for (i = 0; i < 7; i++) { cv168[i] = cv169[i]; } emlrtInitCharArrayR2013a(sp, 7, m32, cv168); emlrtAssign(&y, m32); b_y = NULL; m32 = mxCreateDoubleScalar(1.0); emlrtAssign(&b_y, m32); c_y = NULL; m32 = mxCreateCharArray(2, iv137); for (i = 0; i < 22; i++) { cv170[i] = cv171[i]; } emlrtInitCharArrayR2013a(sp, 22, m32, cv170); emlrtAssign(&c_y, m32); u_size[0] = 1; u_size[1] = varargin_1_size[1]; i = varargin_1_size[0] * varargin_1_size[1]; for (i29 = 0; i29 < i; i29++) { u_data[i29] = varargin_1_data[i29]; } d_y = NULL; m32 = mxCreateCharArray(2, u_size); emlrtInitCharArrayR2013a(sp, u_size[1], m32, (char_T *)&u_data); emlrtAssign(&d_y, m32); st.site = &ew_emlrtRSI; return c_emlrt_marshallIn(&st, b_feval(&st, y, b_y, c_y, d_y, &n_emlrtMCI), "feval"); }
static real_T k_fprintf(const emlrtStack *sp, const char_T varargin_1_data[76], const int32_T varargin_1_size[2]) { const mxArray *y; static const int32_T iv134[2] = { 1, 7 }; const mxArray *m31; char_T cv164[7]; int32_T i; static const char_T cv165[7] = { 'f', 'p', 'r', 'i', 'n', 't', 'f' }; const mxArray *b_y; const mxArray *c_y; static const int32_T iv135[2] = { 1, 18 }; char_T cv166[18]; static const char_T cv167[18] = { 'D', 'L', '|', ' ', 'M', 'e', 's', 's', 'a', 'g', 'e', '=', '|', '%', 's', '|', '\\', 'n' }; int32_T u_size[2]; int32_T i28; char_T u_data[76]; const mxArray *d_y; emlrtStack st; st.prev = sp; st.tls = sp->tls; y = NULL; m31 = mxCreateCharArray(2, iv134); for (i = 0; i < 7; i++) { cv164[i] = cv165[i]; } emlrtInitCharArrayR2013a(sp, 7, m31, cv164); emlrtAssign(&y, m31); b_y = NULL; m31 = mxCreateDoubleScalar(1.0); emlrtAssign(&b_y, m31); c_y = NULL; m31 = mxCreateCharArray(2, iv135); for (i = 0; i < 18; i++) { cv166[i] = cv167[i]; } emlrtInitCharArrayR2013a(sp, 18, m31, cv166); emlrtAssign(&c_y, m31); u_size[0] = 1; u_size[1] = varargin_1_size[1]; i = varargin_1_size[0] * varargin_1_size[1]; for (i28 = 0; i28 < i; i28++) { u_data[i28] = varargin_1_data[i28]; } d_y = NULL; m31 = mxCreateCharArray(2, u_size); emlrtInitCharArrayR2013a(sp, u_size[1], m31, (char_T *)&u_data); emlrtAssign(&d_y, m31); st.site = &ew_emlrtRSI; return c_emlrt_marshallIn(&st, b_feval(&st, y, b_y, c_y, d_y, &n_emlrtMCI), "feval"); }
static real_T s_fprintf(const emlrtStack *sp, int16_T varargin_1, real_T varargin_2) { const mxArray *y; static const int32_T iv142[2] = { 1, 7 }; const mxArray *m35; char_T cv180[7]; int32_T i; static const char_T cv181[7] = { 'f', 'p', 'r', 'i', 'n', 't', 'f' }; const mxArray *b_y; const mxArray *c_y; static const int32_T iv143[2] = { 1, 43 }; char_T cv182[43]; static const char_T cv183[43] = { 'T', 'r', 'a', 'n', 's', 'm', 'i', 't', 't', 'i', 'n', 'g', ' ', 't', 'o', ' ', 'n', 'o', 'd', 'e', ':', ' ', '%', 'd', ',', ' ', 'w', 'i', 't', 'h', ' ', 'o', 'f', 'f', 's', 'e', 't', ':', ' ', '%', 'f', '\\', 'n' }; const mxArray *d_y; const mxArray *e_y; emlrtStack st; st.prev = sp; st.tls = sp->tls; y = NULL; m35 = mxCreateCharArray(2, iv142); for (i = 0; i < 7; i++) { cv180[i] = cv181[i]; } emlrtInitCharArrayR2013a(sp, 7, m35, cv180); emlrtAssign(&y, m35); b_y = NULL; m35 = mxCreateDoubleScalar(1.0); emlrtAssign(&b_y, m35); c_y = NULL; m35 = mxCreateCharArray(2, iv143); for (i = 0; i < 43; i++) { cv182[i] = cv183[i]; } emlrtInitCharArrayR2013a(sp, 43, m35, cv182); emlrtAssign(&c_y, m35); d_y = NULL; m35 = mxCreateNumericMatrix(1, 1, mxINT16_CLASS, mxREAL); *(int16_T *)mxGetData(m35) = varargin_1; emlrtAssign(&d_y, m35); e_y = NULL; m35 = mxCreateDoubleScalar(varargin_2); emlrtAssign(&e_y, m35); st.site = &ew_emlrtRSI; return c_emlrt_marshallIn(&st, c_feval(&st, y, b_y, c_y, d_y, e_y, &n_emlrtMCI), "feval"); }
/* Function Definitions */ void dynamic_size_checks(const emxArray_creal_T *a, const emxArray_creal_T *b) { const mxArray *y; static const int32_T iv32[2] = { 1, 45 }; const mxArray *m5; char_T cv18[45]; int32_T i; static const char_T cv19[45] = { 'C', 'o', 'd', 'e', 'r', ':', 't', 'o', 'o', 'l', 'b', 'o', 'x', ':', 'm', 't', 'i', 'm', 'e', 's', '_', 'n', 'o', 'D', 'y', 'n', 'a', 'm', 'i', 'c', 'S', 'c', 'a', 'l', 'a', 'r', 'E', 'x', 'p', 'a', 'n', 's', 'i', 'o', 'n' }; const mxArray *b_y; static const int32_T iv33[2] = { 1, 21 }; char_T cv20[21]; static const char_T cv21[21] = { 'C', 'o', 'd', 'e', 'r', ':', 'M', 'A', 'T', 'L', 'A', 'B', ':', 'i', 'n', 'n', 'e', 'r', 'd', 'i', 'm' }; if (!(a->size[1] == b->size[0])) { if (((a->size[0] == 1) && (a->size[1] == 1)) || ((b->size[0] == 1) && (b->size[1] == 1))) { emlrtPushRtStackR2012b(&ih_emlrtRSI, emlrtRootTLSGlobal); emlrt_synchGlobalsToML(); y = NULL; m5 = mxCreateCharArray(2, iv32); for (i = 0; i < 45; i++) { cv18[i] = cv19[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 45, m5, cv18); emlrtAssign(&y, m5); error(message(y, &l_emlrtMCI), &m_emlrtMCI); emlrt_synchGlobalsFromML(); emlrtPopRtStackR2012b(&ih_emlrtRSI, emlrtRootTLSGlobal); } else { emlrtPushRtStackR2012b(&hh_emlrtRSI, emlrtRootTLSGlobal); emlrt_synchGlobalsToML(); b_y = NULL; m5 = mxCreateCharArray(2, iv33); for (i = 0; i < 21; i++) { cv20[i] = cv21[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 21, m5, cv20); emlrtAssign(&b_y, m5); error(message(b_y, &n_emlrtMCI), &o_emlrtMCI); emlrt_synchGlobalsFromML(); emlrtPopRtStackR2012b(&hh_emlrtRSI, emlrtRootTLSGlobal); } } }
static real_T o_fprintf(const emlrtStack *sp, int16_T varargin_1) { const mxArray *y; static const int32_T iv138[2] = { 1, 7 }; const mxArray *m33; char_T cv172[7]; int32_T i; static const char_T cv173[7] = { 'f', 'p', 'r', 'i', 'n', 't', 'f' }; const mxArray *b_y; const mxArray *c_y; static const int32_T iv139[2] = { 1, 20 }; char_T cv174[20]; static const char_T cv175[20] = { 'M', 'A', 'C', '|', ' ', 'F', 'r', 'o', 'm', ' ', 'N', 'o', 'd', 'e', ':', ' ', '%', 'd', '\\', 'n' }; const mxArray *d_y; emlrtStack st; st.prev = sp; st.tls = sp->tls; y = NULL; m33 = mxCreateCharArray(2, iv138); for (i = 0; i < 7; i++) { cv172[i] = cv173[i]; } emlrtInitCharArrayR2013a(sp, 7, m33, cv172); emlrtAssign(&y, m33); b_y = NULL; m33 = mxCreateDoubleScalar(1.0); emlrtAssign(&b_y, m33); c_y = NULL; m33 = mxCreateCharArray(2, iv139); for (i = 0; i < 20; i++) { cv174[i] = cv175[i]; } emlrtInitCharArrayR2013a(sp, 20, m33, cv174); emlrtAssign(&c_y, m33); d_y = NULL; m33 = mxCreateNumericMatrix(1, 1, mxINT16_CLASS, mxREAL); *(int16_T *)mxGetData(m33) = varargin_1; emlrtAssign(&d_y, m33); st.site = &ew_emlrtRSI; return c_emlrt_marshallIn(&st, b_feval(&st, y, b_y, c_y, d_y, &n_emlrtMCI), "feval"); }
static void eml_warning(void) { const mxArray *y; static const int32_T iv3[2] = { 1, 27 }; const mxArray *m2; char_T cv4[27]; int32_T i; static const char_T cv5[27] = { 'C', 'o', 'd', 'e', 'r', ':', 'M', 'A', 'T', 'L', 'A', 'B', ':', 's', 'i', 'n', 'g', 'u', 'l', 'a', 'r', 'M', 'a', 't', 'r', 'i', 'x' }; emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); emlrt_synchGlobalsToML(); y = NULL; m2 = mxCreateCharArray(2, iv3); for (i = 0; i < 27; i++) { cv4[i] = cv5[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 27, m2, cv4); emlrtAssign(&y, m2); warning(b_message(y, &d_emlrtMCI), &e_emlrtMCI); emlrt_synchGlobalsFromML(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); }
EXTERN_C void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) { double *unwrapped_image, *wrapped_image; unsigned char *input_mask; int image_width, image_height, wrap_around_x, wrap_around_y; image_width = 96; image_height = 96; wrap_around_x = 0; wrap_around_y = 0; void unwrap2D(double*,double*, unsigned char*, int, int, int, int); mwSize ndim = (int)1; mwSize *dims = (int)9216; plhs[0] = mxCreateDoubleMatrix(96, 96, mxREAL); prhs[0] = mxCreateDoubleMatrix(96, 96, mxREAL); prhs[1] = mxCreateCharArray(ndim, dims); unwrapped_image = mxGetPr(plhs[0]); wrapped_image = mxGetPr(prhs[0]); input_mask = mxArrayToString(mxGetPr(prhs[1])); unwrap2D(wrapped_image, unwrapped_image, input_mask, image_width, image_height, wrap_around_x, wrap_around_y); }
void MxArray::fromVector(const std::vector<char>& v) { const mwSize size[] = {1, v.size()}; p_ = mxCreateCharArray(2, size); if (!p_) mexErrMsgIdAndTxt("mexopencv:error", "Allocation error"); std::copy(v.begin(), v.end(), mxGetChars(p_)); }
/* Function Definitions */ static real_T c_fprintf(const emlrtStack *sp) { const mxArray *y; static const int32_T iv8[2] = { 1, 7 }; const mxArray *m1; char_T cv14[7]; int32_T i; static const char_T cv15[7] = { 'f', 'p', 'r', 'i', 'n', 't', 'f' }; const mxArray *b_y; const mxArray *c_y; static const int32_T iv9[2] = { 1, 50 }; char_T cv16[50]; static const char_T cv17[50] = { 'R', 'e', 'm', 'e', 'm', 'b', 'e', 'r', ' ', 't', 'o', ' ', 'c', 'o', 'm', 'p', 'a', 'r', 'e', ' ', 'o', 'u', 't', 'p', 'u', 't', ' ', 'f', 'i', 'l', 'e', 's', ' ', 'w', 'i', 't', 'h', ' ', 'm', 'd', '5', ' ', 'o', 'r', ' ', 'S', 'H', 'A', '\\', 'n' }; emlrtStack st; st.prev = sp; st.tls = sp->tls; y = NULL; m1 = mxCreateCharArray(2, iv8); for (i = 0; i < 7; i++) { cv14[i] = cv15[i]; } emlrtInitCharArrayR2013a(sp, 7, m1, cv14); emlrtAssign(&y, m1); b_y = NULL; m1 = mxCreateDoubleScalar(1.0); emlrtAssign(&b_y, m1); c_y = NULL; m1 = mxCreateCharArray(2, iv9); for (i = 0; i < 50; i++) { cv16[i] = cv17[i]; } emlrtInitCharArrayR2013a(sp, 50, m1, cv16); emlrtAssign(&c_y, m1); st.site = &cb_emlrtRSI; return e_emlrt_marshallIn(&st, feval(&st, y, b_y, c_y, &r_emlrtMCI), "feval"); }
/* Function Definitions */ void check_forloop_overflow_error(const emlrtStack *sp) { const mxArray *y; static const int32_T iv21[2] = { 1, 34 }; const mxArray *m4; char_T cv27[34]; int32_T i; static const char_T cv28[34] = { 'C', 'o', 'd', 'e', 'r', ':', 't', 'o', 'o', 'l', 'b', 'o', 'x', ':', 'i', 'n', 't', '_', 'f', 'o', 'r', 'l', 'o', 'o', 'p', '_', 'o', 'v', 'e', 'r', 'f', 'l', 'o', 'w' }; const mxArray *b_y; static const int32_T iv22[2] = { 1, 23 }; char_T cv29[23]; static const char_T cv30[23] = { 'c', 'o', 'd', 'e', 'r', '.', 'i', 'n', 't', 'e', 'r', 'n', 'a', 'l', '.', 'i', 'n', 'd', 'e', 'x', 'I', 'n', 't' }; emlrtStack st; emlrtStack b_st; st.prev = sp; st.tls = sp->tls; b_st.prev = sp; b_st.tls = sp->tls; y = NULL; m4 = mxCreateCharArray(2, iv21); for (i = 0; i < 34; i++) { cv27[i] = cv28[i]; } emlrtInitCharArrayR2013a(sp, 34, m4, cv27); emlrtAssign(&y, m4); b_y = NULL; m4 = mxCreateCharArray(2, iv22); for (i = 0; i < 23; i++) { cv29[i] = cv30[i]; } emlrtInitCharArrayR2013a(sp, 23, m4, cv29); emlrtAssign(&b_y, m4); st.site = &vm_emlrtRSI; b_st.site = &ym_emlrtRSI; c_error(&st, message(&b_st, y, b_y, &e_emlrtMCI), &f_emlrtMCI); }
/* Function Definitions */ static real_T c_fprintf(real_T varargin_1) { real_T nbytes; const mxArray *y; static const int32_T iv46[2] = { 1, 7 }; const mxArray *m6; char_T cv22[7]; int32_T i; static const char_T cv23[7] = { 'f', 'p', 'r', 'i', 'n', 't', 'f' }; const mxArray *b_y; static const int32_T iv47[2] = { 1, 48 }; char_T cv24[48]; static const char_T cv25[48] = { 'E', 'r', 'r', 'o', 'r', ':', ' ', 'm', 'a', 't', 'r', 'i', 'x', ' ', 's', 'q', 'u', 'a', 'r', 'e', ' ', 'r', 'o', 'o', 't', ' ', 'r', 'e', 's', 'i', 'd', 'u', 'a', 'l', ' ', 'n', 'o', 'r', 'm', ' ', 'i', 's', ' ', '%', 'g', '.', '\\', 'n' }; emlrtPushRtStackR2012b(&mi_emlrtRSI, emlrtRootTLSGlobal); emlrt_synchGlobalsToML(); y = NULL; m6 = mxCreateCharArray(2, iv46); for (i = 0; i < 7; i++) { cv22[i] = cv23[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 7, m6, cv22); emlrtAssign(&y, m6); b_y = NULL; m6 = mxCreateCharArray(2, iv47); for (i = 0; i < 48; i++) { cv24[i] = cv25[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 48, m6, cv24); emlrtAssign(&b_y, m6); nbytes = emlrt_marshallIn(feval(y, emlrt_marshallOut(1.0), b_y, emlrt_marshallOut(varargin_1), &p_emlrtMCI), "feval"); emlrt_synchGlobalsFromML(); emlrtPopRtStackR2012b(&mi_emlrtRSI, emlrtRootTLSGlobal); return nbytes; }
static real_T u_fprintf(const emlrtStack *sp) { const mxArray *y; static const int32_T iv201[2] = { 1, 7 }; const mxArray *m43; char_T cv249[7]; int32_T i; static const char_T cv250[7] = { 'f', 'p', 'r', 'i', 'n', 't', 'f' }; const mxArray *b_y; const mxArray *c_y; static const int32_T iv202[2] = { 1, 32 }; char_T cv251[32]; static const char_T cv252[32] = { 'M', 'A', 'C', '|', ' ', 'T', 'r', 'a', 'n', 's', 'm', 'i', 't', 't', 'i', 'n', 'g', ' ', 'A', 'C', 'K', ' ', 'f', 'o', 'r', ' ', 'd', 'u', 'p', 'e', '\\', 'n' }; emlrtStack st; st.prev = sp; st.tls = sp->tls; y = NULL; m43 = mxCreateCharArray(2, iv201); for (i = 0; i < 7; i++) { cv249[i] = cv250[i]; } emlrtInitCharArrayR2013a(sp, 7, m43, cv249); emlrtAssign(&y, m43); b_y = NULL; m43 = mxCreateDoubleScalar(1.0); emlrtAssign(&b_y, m43); c_y = NULL; m43 = mxCreateCharArray(2, iv202); for (i = 0; i < 32; i++) { cv251[i] = cv252[i]; } emlrtInitCharArrayR2013a(sp, 32, m43, cv251); emlrtAssign(&c_y, m43); st.site = &ew_emlrtRSI; return c_emlrt_marshallIn(&st, feval(&st, y, b_y, c_y, &n_emlrtMCI), "feval"); }
static real_T i_fprintf(const emlrtStack *sp) { const mxArray *y; static const int32_T iv84[2] = { 1, 7 }; const mxArray *m17; char_T cv98[7]; int32_T i; static const char_T cv99[7] = { 'f', 'p', 'r', 'i', 'n', 't', 'f' }; const mxArray *b_y; const mxArray *c_y; static const int32_T iv85[2] = { 1, 26 }; char_T cv100[26]; static const char_T cv101[26] = { 'D', 'L', '|', ' ', 'M', 'a', 'x', ' ', 't', 'i', 'm', 'e', 'o', 'u', 't', 's', ' ', 'r', 'e', 'a', 'c', 'h', 'e', 'd', '\\', 'n' }; emlrtStack st; st.prev = sp; st.tls = sp->tls; y = NULL; m17 = mxCreateCharArray(2, iv84); for (i = 0; i < 7; i++) { cv98[i] = cv99[i]; } emlrtInitCharArrayR2013a(sp, 7, m17, cv98); emlrtAssign(&y, m17); b_y = NULL; m17 = mxCreateDoubleScalar(1.0); emlrtAssign(&b_y, m17); c_y = NULL; m17 = mxCreateCharArray(2, iv85); for (i = 0; i < 26; i++) { cv100[i] = cv101[i]; } emlrtInitCharArrayR2013a(sp, 26, m17, cv100); emlrtAssign(&c_y, m17); st.site = &ew_emlrtRSI; return c_emlrt_marshallIn(&st, feval(&st, y, b_y, c_y, &n_emlrtMCI), "feval"); }
static real_T e_fprintf(const emlrtStack *sp) { const mxArray *y; static const int32_T iv10[2] = { 1, 7 }; const mxArray *m2; char_T cv18[7]; int32_T i; static const char_T cv19[7] = { 'f', 'p', 'r', 'i', 'n', 't', 'f' }; const mxArray *b_y; const mxArray *c_y; static const int32_T iv11[2] = { 1, 31 }; char_T cv20[31]; static const char_T cv21[31] = { 'f', 'i', 'l', 'e', 'S', 'o', 'u', 'r', 'c', 'e', 'S', 'i', 'n', 'k', ' ', 'T', 'e', 's', 't', ' ', 'C', 'o', 'm', 'p', 'l', 'e', 't', 'e', 'd', '\\', 'n' }; emlrtStack st; st.prev = sp; st.tls = sp->tls; y = NULL; m2 = mxCreateCharArray(2, iv10); for (i = 0; i < 7; i++) { cv18[i] = cv19[i]; } emlrtInitCharArrayR2013a(sp, 7, m2, cv18); emlrtAssign(&y, m2); b_y = NULL; m2 = mxCreateDoubleScalar(1.0); emlrtAssign(&b_y, m2); c_y = NULL; m2 = mxCreateCharArray(2, iv11); for (i = 0; i < 31; i++) { cv20[i] = cv21[i]; } emlrtInitCharArrayR2013a(sp, 31, m2, cv20); emlrtAssign(&c_y, m2); st.site = &cb_emlrtRSI; return e_emlrt_marshallIn(&st, feval(&st, y, b_y, c_y, &r_emlrtMCI), "feval"); }
static real_T c_fprintf(const emlrtStack *sp) { const mxArray *y; static const int32_T iv78[2] = { 1, 7 }; const mxArray *m14; char_T cv86[7]; int32_T i; static const char_T cv87[7] = { 'f', 'p', 'r', 'i', 'n', 't', 'f' }; const mxArray *b_y; const mxArray *c_y; static const int32_T iv79[2] = { 1, 23 }; char_T cv88[23]; static const char_T cv89[23] = { 'D', 'L', '|', ' ', 'D', 'u', 'p', 'l', 'i', 'c', 'a', 't', 'e', ' ', 'M', 'e', 's', 's', 'a', 'g', 'e', '\\', 'n' }; emlrtStack st; st.prev = sp; st.tls = sp->tls; y = NULL; m14 = mxCreateCharArray(2, iv78); for (i = 0; i < 7; i++) { cv86[i] = cv87[i]; } emlrtInitCharArrayR2013a(sp, 7, m14, cv86); emlrtAssign(&y, m14); b_y = NULL; m14 = mxCreateDoubleScalar(1.0); emlrtAssign(&b_y, m14); c_y = NULL; m14 = mxCreateCharArray(2, iv79); for (i = 0; i < 23; i++) { cv88[i] = cv89[i]; } emlrtInitCharArrayR2013a(sp, 23, m14, cv88); emlrtAssign(&c_y, m14); st.site = &ew_emlrtRSI; return c_emlrt_marshallIn(&st, feval(&st, y, b_y, c_y, &n_emlrtMCI), "feval"); }
static real_T g_fprintf(const emlrtStack *sp) { const mxArray *y; static const int32_T iv82[2] = { 1, 7 }; const mxArray *m16; char_T cv94[7]; int32_T i; static const char_T cv95[7] = { 'f', 'p', 'r', 'i', 'n', 't', 'f' }; const mxArray *b_y; const mxArray *c_y; static const int32_T iv83[2] = { 1, 21 }; char_T cv96[21]; static const char_T cv97[21] = { 'D', 'L', '|', ' ', 'T', 'i', 'm', 'e', 'o', 'u', 't', ' ', 'o', 'c', 'c', 'u', 'r', 'e', 'd', '\\', 'n' }; emlrtStack st; st.prev = sp; st.tls = sp->tls; y = NULL; m16 = mxCreateCharArray(2, iv82); for (i = 0; i < 7; i++) { cv94[i] = cv95[i]; } emlrtInitCharArrayR2013a(sp, 7, m16, cv94); emlrtAssign(&y, m16); b_y = NULL; m16 = mxCreateDoubleScalar(1.0); emlrtAssign(&b_y, m16); c_y = NULL; m16 = mxCreateCharArray(2, iv83); for (i = 0; i < 21; i++) { cv96[i] = cv97[i]; } emlrtInitCharArrayR2013a(sp, 21, m16, cv96); emlrtAssign(&c_y, m16); st.site = &ew_emlrtRSI; return c_emlrt_marshallIn(&st, feval(&st, y, b_y, c_y, &n_emlrtMCI), "feval"); }
void error(const emlrtStack *sp, const char_T varargin_2_data[1024], const int32_T varargin_2_size[2]) { const mxArray *y; static const int32_T iv103[2] = { 1, 37 }; const mxArray *m18; char_T cv117[37]; int32_T i; static const char_T cv118[37] = { 's', 'd', 'r', 'u', ':', 'S', 'D', 'R', 'u', 'R', 'e', 'c', 'e', 'i', 'v', 'e', 'r', ':', 'R', 'e', 'c', 'e', 'i', 'v', 'e', 'U', 'n', 's', 'u', 'c', 'c', 'e', 's', 's', 'f', 'u', 'l' }; int32_T u_size[2]; int32_T i16; char_T u_data[1024]; const mxArray *b_y; emlrtStack st; st.prev = sp; st.tls = sp->tls; y = NULL; m18 = mxCreateCharArray(2, iv103); for (i = 0; i < 37; i++) { cv117[i] = cv118[i]; } emlrtInitCharArrayR2013a(sp, 37, m18, cv117); emlrtAssign(&y, m18); u_size[0] = 1; u_size[1] = varargin_2_size[1]; i = varargin_2_size[0] * varargin_2_size[1]; for (i16 = 0; i16 < i; i16++) { u_data[i16] = varargin_2_data[i16]; } b_y = NULL; m18 = mxCreateCharArray(2, u_size); emlrtInitCharArrayR2013a(sp, u_size[1], m18, (char_T *)&u_data); emlrtAssign(&b_y, m18); st.site = &hr_emlrtRSI; c_error(&st, y, b_y, &r_emlrtMCI); }
void b_error(const emlrtStack *sp, const char_T varargin_2_data[1024], const int32_T varargin_2_size[2]) { const mxArray *y; static const int32_T iv174[2] = { 1, 41 }; const mxArray *m31; char_T cv203[41]; int32_T i; static const char_T cv204[41] = { 's', 'd', 'r', 'u', ':', 'S', 'D', 'R', 'u', 'T', 'r', 'a', 'n', 's', 'm', 'i', 't', 't', 'e', 'r', ':', 'T', 'r', 'a', 'n', 's', 'm', 'i', 't', 'U', 'n', 's', 'u', 'c', 'c', 'e', 's', 's', 'f', 'u', 'l' }; int32_T u_size[2]; int32_T i20; char_T u_data[1024]; const mxArray *b_y; emlrtStack st; st.prev = sp; st.tls = sp->tls; y = NULL; m31 = mxCreateCharArray(2, iv174); for (i = 0; i < 41; i++) { cv203[i] = cv204[i]; } emlrtInitCharArrayR2013a(sp, 41, m31, cv203); emlrtAssign(&y, m31); u_size[0] = 1; u_size[1] = varargin_2_size[1]; i = varargin_2_size[0] * varargin_2_size[1]; for (i20 = 0; i20 < i; i20++) { u_data[i20] = varargin_2_data[i20]; } b_y = NULL; m31 = mxCreateCharArray(2, u_size); emlrtInitCharArrayR2013a(sp, u_size[1], m31, (char_T *)&u_data); emlrtAssign(&b_y, m31); st.site = &acb_emlrtRSI; d_error(&st, y, b_y, &r_emlrtMCI); }
mxArray* make_substring(const mxChar* src, const Range& rgn) { if (rgn.isempty()) { mwSize z[2] = {0, 0}; return mxCreateCharArray(2, z); } mwSize dims[2] = {1, rgn.length()}; mxArray* mxS = mxCreateCharArray(2, dims); mxChar* dst = (mxChar*)mxGetData(mxS); for(int i = rgn.start-1; i < rgn.last; ++i) { *dst++ = src[i]; } return mxS; }
static real_T e_fprintf(real_T varargin_1) { real_T nbytes; const mxArray *y; static const int32_T iv2[2] = { 1, 7 }; const mxArray *m1; char_T cv4[7]; int32_T i; static const char_T cv5[7] = { 'f', 'p', 'r', 'i', 'n', 't', 'f' }; const mxArray *b_y; static const int32_T iv3[2] = { 1, 25 }; char_T cv6[25]; static const char_T cv7[25] = { 'B', 'E', 'R', ' ', 'f', 'o', 'r', ' ', 'p', 'r', 'e', 'a', 'm', 'b', 'l', 'e', ':', ' ', '%', '.', '1', '0', 'f', '\\', 'n' }; emlrtPushRtStackR2012b(&d_emlrtRSI, emlrtRootTLSGlobal); emlrt_synchGlobalsToML(); y = NULL; m1 = mxCreateCharArray(2, iv2); for (i = 0; i < 7; i++) { cv4[i] = cv5[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 7, m1, cv4); emlrtAssign(&y, m1); b_y = NULL; m1 = mxCreateCharArray(2, iv3); for (i = 0; i < 25; i++) { cv6[i] = cv7[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 25, m1, cv6); emlrtAssign(&b_y, m1); nbytes = emlrt_marshallIn(feval(y, emlrt_marshallOut(1.0), b_y, emlrt_marshallOut(varargin_1), &emlrtMCI), "feval"); emlrt_synchGlobalsFromML(); emlrtPopRtStackR2012b(&d_emlrtRSI, emlrtRootTLSGlobal); return nbytes; }
void error(const emlrtStack *sp, const char_T varargin_2_data[1024], const int32_T varargin_2_size[2]) { const mxArray *y; static const int32_T iv122[2] = { 1, 37 }; const mxArray *m20; char_T cv141[37]; int32_T i; static const char_T cv142[37] = { 's', 'd', 'r', 'u', ':', 'S', 'D', 'R', 'u', 'R', 'e', 'c', 'e', 'i', 'v', 'e', 'r', ':', 'R', 'e', 'c', 'e', 'i', 'v', 'e', 'U', 'n', 's', 'u', 'c', 'c', 'e', 's', 's', 'f', 'u', 'l' }; int32_T u_size[2]; int32_T i17; char_T u_data[1024]; const mxArray *b_y; emlrtStack st; st.prev = sp; st.tls = sp->tls; y = NULL; m20 = mxCreateCharArray(2, iv122); for (i = 0; i < 37; i++) { cv141[i] = cv142[i]; } emlrtInitCharArrayR2013a(sp, 37, m20, cv141); emlrtAssign(&y, m20); u_size[0] = 1; u_size[1] = varargin_2_size[1]; i = varargin_2_size[0] * varargin_2_size[1]; for (i17 = 0; i17 < i; i17++) { u_data[i17] = varargin_2_data[i17]; } b_y = NULL; m20 = mxCreateCharArray(2, u_size); emlrtInitCharArrayR2013a(sp, u_size[1], m20, (char_T *)&u_data); emlrtAssign(&b_y, m20); st.site = &acb_emlrtRSI; d_error(&st, y, b_y, &r_emlrtMCI); }
/* Function Definitions */ static real_T c_fprintf(real_T varargin_1) { real_T nbytes; const mxArray *y; static const int32_T iv0[2] = { 1, 7 }; const mxArray *m0; char_T cv0[7]; int32_T i; static const char_T cv1[7] = { 'f', 'p', 'r', 'i', 'n', 't', 'f' }; const mxArray *b_y; static const int32_T iv1[2] = { 1, 21 }; char_T cv2[21]; static const char_T cv3[21] = { 'B', 'E', 'R', ' ', 'f', 'o', 'r', ' ', 'd', 'a', 't', 'a', ':', ' ', '%', '.', '1', '0', 'f', '\\', 'n' }; emlrtPushRtStackR2012b(&d_emlrtRSI, emlrtRootTLSGlobal); emlrt_synchGlobalsToML(); y = NULL; m0 = mxCreateCharArray(2, iv0); for (i = 0; i < 7; i++) { cv0[i] = cv1[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 7, m0, cv0); emlrtAssign(&y, m0); b_y = NULL; m0 = mxCreateCharArray(2, iv1); for (i = 0; i < 21; i++) { cv2[i] = cv3[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 21, m0, cv2); emlrtAssign(&b_y, m0); nbytes = emlrt_marshallIn(feval(y, emlrt_marshallOut(1.0), b_y, emlrt_marshallOut(varargin_1), &emlrtMCI), "feval"); emlrt_synchGlobalsFromML(); emlrtPopRtStackR2012b(&d_emlrtRSI, emlrtRootTLSGlobal); return nbytes; }
void check_forloop_overflow_error(void) { const mxArray *y; static const int32_T iv0[2] = { 1, 34 }; const mxArray *m1; char_T cv0[34]; int32_T i; static const char_T cv1[34] = { 'C', 'o', 'd', 'e', 'r', ':', 't', 'o', 'o', 'l', 'b', 'o', 'x', ':', 'i', 'n', 't', '_', 'f', 'o', 'r', 'l', 'o', 'o', 'p', '_', 'o', 'v', 'e', 'r', 'f', 'l', 'o', 'w' }; const mxArray *b_y; static const int32_T iv1[2] = { 1, 23 }; char_T cv2[23]; static const char_T cv3[23] = { 'c', 'o', 'd', 'e', 'r', '.', 'i', 'n', 't', 'e', 'r', 'n', 'a', 'l', '.', 'i', 'n', 'd', 'e', 'x', 'I', 'n', 't' }; emlrtPushRtStackR2012b(&h_emlrtRSI, emlrtRootTLSGlobal); emlrt_synchGlobalsToML(); y = NULL; m1 = mxCreateCharArray(2, iv0); for (i = 0; i < 34; i++) { cv0[i] = cv1[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 34, m1, cv0); emlrtAssign(&y, m1); b_y = NULL; m1 = mxCreateCharArray(2, iv1); for (i = 0; i < 23; i++) { cv2[i] = cv3[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 23, m1, cv2); emlrtAssign(&b_y, m1); error(message(y, b_y, &b_emlrtMCI), &c_emlrtMCI); emlrt_synchGlobalsFromML(); emlrtPopRtStackR2012b(&h_emlrtRSI, emlrtRootTLSGlobal); }
/* ************************************************************** */ void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) { char *g; /* M char array data reformatted for C */ int oN, iN, gN; /* lengths of M char array data */ int f; int* fp; /* flag bits */ int idx; short *pr; /* for M mxChar type */ mwSize dims[2]; /* check inputs */ mxAssert(nrhs == 2 || nrhs == 3, "bad call: use gem(i,g) or gem(i,g,f)"); mxAssert(nlhs<=1, "bad call: use o = gem(i,g)"); /* grab user input text */ mxAssert(mxIsChar(prhs[0]), "bad call 1rst arg: requires char"); iN = mxGetM(prhs[0])*mxGetN(prhs[0]); mxAssert(iN<DATALIM, "bad call 1rst arg: input is too long"); pr = (short*)mxGetData(prhs[0]); for (idx=0; idx<iN; idx++) input[idx] = (unsigned char)*(pr+idx)&0xFF; input[iN] = 0; /* null terminate */ i = input; /* the input */ /* grab user grammar */ mxAssert(mxIsChar(prhs[1]), "bad call 2nd arg: requires char"); gN = mxGetM(prhs[1])*mxGetN(prhs[1]); mxAssert(gN<DATALIM, "bad call 2nd arg: input is too long"); pr = (short*)mxGetData(prhs[1]); for (idx=0; idx<gN; idx++) code[idx] = (unsigned char)*(pr+idx)&0xFF; code[gN] = 0; /* null terminate */ g = code; /* the code */ /* grab flags */ if (nrhs == 3) { mxAssert(mxIsUint32(prhs[2]), "bad call 3rd arg: requires int32"); fp = (int*)mxGetData(prhs[2]); /* flag bits */ f = *fp; } else { f = 0; /* no flags */ } pregem(i, iN, g, gN, f); /* set up globals */ gem(); /* translate */ /* push output */ oN = o-output+1; /* number of output chars */ o = output; dims[0] = 1; dims[1] = oN; plhs[0] = mxCreateCharArray(2, (const mwSize*)&dims); pr = (short*)mxGetData(plhs[0]); /* 16 bits per char */ for (idx=0; idx<oN; idx++) *(pr+idx) = (*o++)&0xFF; }
real_T bisection2(real_T a, real_T b, real_T tol) { real_T p; const mxArray *y; static const int32_T iv0[2] = { 1, 16 }; const mxArray *m0; static const char_T cv0[16] = { 'W', 'r', 'o', 'n', 'g', ' ', 'c', 'h', 'o', 'i', 'c', 'e', ' ', 'b', 'r', 'o' }; real_T err; /* provide the equation you want to solve with R.H.S = 0 form. */ /* Write the L.H.S by using inline function */ /* Give initial guesses. */ /* Solves it by method of bisection. */ /* A very simple code and very handy! */ if ((muDoubleScalarPower(a - 1.5, 3.0) + 10.0) * (muDoubleScalarPower(b - 1.5, 3.0) + 10.0) > 0.0) { EMLRTPUSHRTSTACK(&emlrtRSI); EMLRTPUSHRTSTACK(&b_emlrtRSI); y = NULL; m0 = mxCreateCharArray(2, iv0); emlrtInitCharArray(16, m0, cv0); emlrtAssign(&y, m0); error(y, &emlrtMCI); EMLRTPOPRTSTACK(&b_emlrtRSI); EMLRTPOPRTSTACK(&emlrtRSI); } else { p = (a + b) / 2.0; err = muDoubleScalarAbs(b - a); while (err >= tol) { if ((muDoubleScalarPower(a - 1.5, 3.0) + 10.0) * (muDoubleScalarPower(p - 1.5, 3.0) + 10.0) < 0.0) { b = p; } else { a = p; } p = (a + b) / 2.0; err = muDoubleScalarAbs(b - a); emlrtBreakCheck(); } } return p; }
/** Convert Python string to Matlab char array * :param obj: Object to convert [Borrow reference] */ mxArray *mx_from_py_string(PyObject* obj) { mxArray *r; int dims[2]; char *buf; int len; mxChar* p; PyString_AsStringAndSize(obj, &buf, &len); dims[0] = 1; dims[1] = len; r = mxCreateCharArray(2, dims); p = mxGetData(r); for (; len > 0; --len) { *p = *buf; ++p; ++buf; } return r; }
void my_mexReturnCharArray(int nlhs, mxArray *plhs[], const char *buff,int bufflen) { int ndim = 2, dims[2]; mxArray *array_ptr; mxChar *pr; int c; unsigned char *ubuff; /* src buffert pointer as unsigned char. */ if(bufflen==0) { dims[0]=0; dims[1]=0; } else { dims[0]=1; dims[1]=bufflen; } if(ret_args>nlhs & ret_args>1) return; /* Create a 2-Dimensional character mxArray. */ array_ptr = mxCreateCharArray(ndim, dims); if (array_ptr == NULL) mexErrMsgTxt("Could not create Character mxArray."); pr = (mxChar *)mxGetPr(array_ptr); ubuff=(unsigned char *)buff; /* readout data as unsigned */ for (c=0;c<bufflen;c++) { *pr = (mxChar)(*ubuff); ubuff++; pr++; } plhs[ret_args]=array_ptr; ret_args++; }
/* here comes the main function */ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { int ne, ncells; const int *dim; mxChar *glued, gluechar; const mxChar *toglue; const mxChar *glue; const mxChar defglue[1] = {CHAR_LF}; const mxArray *snippet, *togluec; int odim[2] = {1, 0}; signed long gluelen = 1, copypos = 0, totallen = 0, sc = 0; bool endterm = 0; /* check argument count and content */ if (nrhs < 1 || nrhs > 3 || nlhs > 1) mexErrMsgTxt("Bad number of input/output arguments."); if (mxGetClassID(*prhs) != mxCELL_CLASS) mexErrMsgTxt("First input must be a cell array."); togluec = *prhs; ncells = mxGetNumberOfElements(togluec); if (ncells == 0) { *odim = 0; *plhs = mxCreateCharArray(2, odim); return; } glue = defglue; if ((nrhs > 1) && (mxGetClassID(prhs[1]) == mxCHAR_CLASS)) { dim = mxGetDimensions(prhs[1]); if ((dim[1] > 0) && (dim[1] == mxGetNumberOfElements(prhs[1]))) { glue = (const mxChar *) mxGetData(prhs[1]); gluelen = dim[1]; } } if (nrhs > 2) { if ((mxGetClassID(prhs[2]) == mxLOGICAL_CLASS) && (mxGetNumberOfElements(prhs[2]) == 1)) endterm = (*((unsigned char *) mxGetData(prhs[2])) != 0); } /* count real snippets and length */ for (; sc < ncells; ++sc) { snippet = mxGetCell(togluec, sc); if (mxGetClassID(snippet) != mxCHAR_CLASS) mexErrMsgTxt("All cells must be of type char."); totallen += mxGetNumberOfElements(snippet); } totallen += gluelen * ((endterm) ? (ncells) : (ncells - 1)); /* create output */ odim[1] = totallen; *plhs = mxCreateCharArray(2, odim); glued = (mxChar *) mxGetData(*plhs); /* depending on gluelen */ gluechar = *glue; --ncells; switch (gluelen) { case 0: for (sc = 0; sc < ncells; ++sc) { snippet = mxGetCell(togluec, sc); toglue = (const mxChar*) mxGetData(snippet); ne = mxGetNumberOfElements(snippet); for (copypos = ne; copypos > 0; --copypos) *glued++ = *toglue++; } break; case 1: for (sc = 0; sc < ncells; ++sc) { snippet = mxGetCell(togluec, sc); toglue = (const mxChar*) mxGetData(snippet); ne = mxGetNumberOfElements(snippet); for (copypos = ne; copypos > 0; --copypos) *glued++ = *toglue++; *glued++ = gluechar; } break; case 2: for (sc = 0; sc < ncells; ++sc) { snippet = mxGetCell(togluec, sc); toglue = (const mxChar*) mxGetData(snippet); ne = mxGetNumberOfElements(snippet); for (copypos = ne; copypos > 0; --copypos) *glued++ = *toglue++; *glued++ = gluechar; *glued++ = glue[1]; } break; default: for (sc = 0; sc < ncells; ++sc) { snippet = mxGetCell(togluec, sc); toglue = (const mxChar*) mxGetData(snippet); ne = mxGetNumberOfElements(snippet); for (copypos = ne; copypos > 0; --copypos) *glued++ = *toglue++; *glued++ = gluechar; for (copypos = 1; copypos < gluelen; ++copypos) *glued++ = glue[copypos]; } break; } snippet = mxGetCell(togluec, sc); ne = mxGetNumberOfElements(snippet); if (ne > 0) { toglue = (const mxChar*) mxGetData(snippet); for (copypos = ne; copypos > 0; --copypos) *glued++ = *toglue++; } if (endterm) for (copypos = 0; copypos < gluelen; ++copypos) *glued++ = *glue++; }
int bytesToMx(mxArray **mx, const char *byteArray, int byteArrayLength) { int ii; int nInfoBytes=0, nFreeBytes=0, nBytesRead=0; mxGramInfo info; // for complex types int jj; int nElements; mxArray *elementData; mxArray *elementName; const char *elementByteArray; int elementBytesRead; char **fieldNames; mxArray *callMatlabError; info.gramBytes = (char *)byteArray; nInfoBytes = readInfoFieldsFromBytes(&info, byteArray, byteArrayLength); nBytesRead += nInfoBytes; info.dataBytes = (char *)byteArray + MX_GRAM_OFFSET_DATA; nFreeBytes = byteArrayLength - MX_GRAM_OFFSET_DATA; //printMxGramInfo(&info); //printBytes(info.gramBytes, info.gramLength); if (info.gramType==mxGramDouble) { *mx = mxCreateDoubleMatrix(info.dataM, info.dataN, mxREAL); nBytesRead += readMxDoubleDataFromBytes(*mx, &info, nFreeBytes); } else if (info.gramType==mxGramChar) { mwSize dims[2]; dims[0] = info.dataM; dims[1] = info.dataN; *mx = mxCreateCharArray(2, dims); nBytesRead += readMxCharDataFromBytes(*mx, &info, nFreeBytes); } else if (info.gramType==mxGramLogical) { *mx = mxCreateLogicalMatrix(info.dataM, info.dataN); nBytesRead += readMxLogicalDataFromBytes(*mx, &info, nFreeBytes); } else if (info.gramType==mxGramCell) { *mx = mxCreateCellMatrix(info.dataM, info.dataN); nElements = info.dataM * info.dataN; elementByteArray = info.dataBytes; elementBytesRead = 0; for (ii=0; ii<nElements; ii++) { elementBytesRead = bytesToMx(&elementData, elementByteArray, nFreeBytes); if (elementBytesRead > 0) { mxSetCell(*mx, ii, elementData); nBytesRead += elementBytesRead; elementByteArray += elementBytesRead; nFreeBytes -= elementBytesRead; } } } else if (info.gramType==mxGramStruct) { // struct arrays may have size 1xn, with m fields nElements = info.dataM; fieldNames = mxMalloc(nElements*sizeof(char*)); // recur to read out fieldNames elementByteArray = info.dataBytes; for (ii=0; ii<nElements; ii++) { elementBytesRead = bytesToMx(&elementName, elementByteArray, nFreeBytes); fieldNames[ii] = mxArrayToString(elementName); mxDestroyArray(elementName); nBytesRead += elementBytesRead; elementByteArray += elementBytesRead; nFreeBytes -= elementBytesRead; } *mx = mxCreateStructMatrix(1, info.dataN, info.dataM, (const char **)fieldNames); mxFree(fieldNames); // recur to fill in field data for (ii=0; ii<nElements; ii++) { for (jj=0; jj<info.dataN; jj++) { elementBytesRead = bytesToMx(&elementData, elementByteArray, nFreeBytes); mxSetFieldByNumber(*mx, jj, ii, elementData); nBytesRead += elementBytesRead; elementByteArray += elementBytesRead; nFreeBytes -= elementBytesRead; } } } else if (info.gramType==mxGramFunctionHandle) { // recur to read out stringified version of function elementBytesRead = bytesToMx(&elementData, info.dataBytes, nFreeBytes); if (elementBytesRead > 0) { nBytesRead += elementBytesRead; callMatlabError = mexCallMATLABWithTrap(1, mx, 1, &elementData, MX_GRAM_STRING_TO_FUNCTION); } } else { *mx = mxCreateDoubleScalar(-1); nBytesRead = 0; } return(nBytesRead); }
/* Function Definitions */ void receiveData(const emlrtStack *sp, int32_T driverApiH, real_T freq, real_T loOffset, real_T gain, real_T decim, cint16_T data[46336], uint32_T *dataLength, uint32_T *overflow, UsrpErrorCapiEnumT *errStat, char_T errStr_data[1024], int32_T errStr_size[2]) { const mxArray *y; static const int32_T iv121[2] = { 1, 6 }; const mxArray *m19; char_T cv139[6]; int32_T i; static const char_T cv140[6] = { 's', 'i', 'l', 'e', 'n', 't' }; const mxArray *b_y; int32_T loop_ub; char_T b_errStr_data[1024]; emlrtStack st; emlrtStack b_st; st.prev = sp; st.tls = sp->tls; b_st.prev = &st; b_st.tls = st.tls; /* Copyright 2011-2012 The MathWorks, Inc. */ st.site = &jn_emlrtRSI; /* */ /* This function unifies handling of interp vs. codegen call as well as */ /* errStat / errStr assignment. */ /* */ /* Copyright 2011-2013 The MathWorks, Inc. */ if (!isSetupsdruCalled) { y = NULL; m19 = mxCreateCharArray(2, iv121); for (i = 0; i < 6; i++) { cv139[i] = cv140[i]; } emlrtInitCharArrayR2013a(&st, 6, m19, cv139); emlrtAssign(&y, m19); b_st.site = &ybb_emlrtRSI; setupsdru(&b_st, sdruroot(&b_st, &o_emlrtMCI), y, &p_emlrtMCI); isSetupsdruCalled = TRUE; } /* These sizes must match those in C code. */ /* Arbitrary max imposed on ML/SL side */ /* function is being called in interpreted mode */ /* not being found: */ /* eml_allow_enum_inputs; */ /* errStat_i = int32(0); */ for (i = 0; i < 1024; i++) { errStr_data[i] = '\x00'; } /* 46336 represents 0.00185344 seconds at 25Msps. 1 ms seems to be a decent */ /* time interval to interact with the IP stack on a default glnxa64 machine. */ /* 32768 seems to be the max for UHD(TM) so we may want to change to that. */ receiveData_c(driverApiH, freq, loOffset, gain, decim, data, dataLength, overflow, errStat, &errStr_data[0]); /* errStat = UsrpErrorCapiEnumT(errStat_i); */ i = strlen(&errStr_data[0]); if (i <= 1024) { } else { b_y = NULL; m19 = mxCreateString("Assertion failed."); emlrtAssign(&b_y, m19); b_st.site = &mbb_emlrtRSI; c_error(&b_st, b_y, &n_emlrtMCI); } if (1 > i) { loop_ub = 0; } else { loop_ub = emlrtDynamicBoundsCheckFastR2012b(i, 1, 1024, &p_emlrtBCI, &st); } for (i = 0; i < loop_ub; i++) { b_errStr_data[i] = errStr_data[i]; } errStr_size[0] = 1; errStr_size[1] = loop_ub; for (i = 0; i < loop_ub; i++) { errStr_data[i] = b_errStr_data[i]; } }