Exemplo n.º 1
0
/*
 * Arguments    : const mxArray *prhs[19]
 *                const mxArray *plhs[4]
 * Return Type  : void
 */
void clcDP_olyHyb_tmp_api(const mxArray *prhs[19], const mxArray *plhs[4])
{
  emxArray_real_T *engKinNumVec_wayInx;
  emxArray_real_T *slpVec_wayInx;
  emxArray_real_T *engKinMat_engKinInx_wayInx;
  static struct0_T FZG;
  emxArray_real_T *optPreInxTn3;
  emxArray_real_T *batFrcOptTn3;
  emxArray_real_T *fulEngOptTn3;
  emxArray_real_T *cos2goActMat;
  real_T disFlg;
  real_T wayStp;
  real_T batEngStp;
  real_T batEngBeg;
  real_T batPwrAux;
  real_T psiBatEng;
  real_T psiTim;
  real_T staChgPenCosVal;
  real_T wayInxBeg;
  real_T wayInxEnd;
  real_T engKinBegInx;
  real_T engKinNum;
  real_T staNum;
  real_T wayNum;
  real_T staBeg;
  emlrtStack st = { NULL, NULL, NULL };

  st.tls = emlrtRootTLSGlobal;
  emlrtHeapReferenceStackEnterFcnR2012b(&st);
  emxInit_real_T(&st, &engKinNumVec_wayInx, 1, true);
  emxInit_real_T(&st, &slpVec_wayInx, 1, true);
  b_emxInit_real_T(&st, &engKinMat_engKinInx_wayInx, 2, true);
  emxInitStruct_struct0_T(&st, &FZG, true);
  c_emxInit_real_T(&st, &optPreInxTn3, 3, true);
  c_emxInit_real_T(&st, &batFrcOptTn3, 3, true);
  c_emxInit_real_T(&st, &fulEngOptTn3, 3, true);
  b_emxInit_real_T(&st, &cos2goActMat, 2, true);
  prhs[15] = emlrtProtectR2012b(prhs[15], 15, false, -1);
  prhs[16] = emlrtProtectR2012b(prhs[16], 16, false, -1);
  prhs[17] = emlrtProtectR2012b(prhs[17], 17, false, -1);

  /* Marshall function inputs */
  disFlg = emlrt_marshallIn(&st, emlrtAliasP(prhs[0]), "disFlg");
  wayStp = emlrt_marshallIn(&st, emlrtAliasP(prhs[1]), "wayStp");
  batEngStp = emlrt_marshallIn(&st, emlrtAliasP(prhs[2]), "batEngStp");
  batEngBeg = emlrt_marshallIn(&st, emlrtAliasP(prhs[3]), "batEngBeg");
  batPwrAux = emlrt_marshallIn(&st, emlrtAliasP(prhs[4]), "batPwrAux");
  psiBatEng = emlrt_marshallIn(&st, emlrtAliasP(prhs[5]), "psiBatEng");
  psiTim = emlrt_marshallIn(&st, emlrtAliasP(prhs[6]), "psiTim");
  staChgPenCosVal = emlrt_marshallIn(&st, emlrtAliasP(prhs[7]),
    "staChgPenCosVal");
  wayInxBeg = emlrt_marshallIn(&st, emlrtAliasP(prhs[8]), "wayInxBeg");
  wayInxEnd = emlrt_marshallIn(&st, emlrtAliasP(prhs[9]), "wayInxEnd");
  engKinBegInx = emlrt_marshallIn(&st, emlrtAliasP(prhs[10]), "engKinBegInx");
  engKinNum = emlrt_marshallIn(&st, emlrtAliasP(prhs[11]), "engKinNum");
  staNum = emlrt_marshallIn(&st, emlrtAliasP(prhs[12]), "staNum");
  wayNum = emlrt_marshallIn(&st, emlrtAliasP(prhs[13]), "wayNum");
  staBeg = emlrt_marshallIn(&st, emlrtAliasP(prhs[14]), "staBeg");
  c_emlrt_marshallIn(&st, emlrtAlias(prhs[15]), "engKinNumVec_wayInx",
                     engKinNumVec_wayInx);
  c_emlrt_marshallIn(&st, emlrtAlias(prhs[16]), "slpVec_wayInx", slpVec_wayInx);
  e_emlrt_marshallIn(&st, emlrtAlias(prhs[17]), "engKinMat_engKinInx_wayInx",
                     engKinMat_engKinInx_wayInx);
  g_emlrt_marshallIn(&st, emlrtAliasP(prhs[18]), "FZG", &FZG);

  /* Invoke the target function */
  clcDP_olyHyb_tmp(disFlg, wayStp, batEngStp, batEngBeg, batPwrAux, psiBatEng,
                   psiTim, staChgPenCosVal, wayInxBeg, wayInxEnd, engKinBegInx,
                   engKinNum, staNum, wayNum, staBeg, engKinNumVec_wayInx,
                   slpVec_wayInx, engKinMat_engKinInx_wayInx, &FZG, optPreInxTn3,
                   batFrcOptTn3, fulEngOptTn3, cos2goActMat);

  /* Marshall function outputs */
  plhs[0] = emlrt_marshallOut(optPreInxTn3);
  plhs[1] = emlrt_marshallOut(batFrcOptTn3);
  plhs[2] = emlrt_marshallOut(fulEngOptTn3);
  plhs[3] = b_emlrt_marshallOut(cos2goActMat);
  cos2goActMat->canFreeData = false;
  emxFree_real_T(&cos2goActMat);
  fulEngOptTn3->canFreeData = false;
  emxFree_real_T(&fulEngOptTn3);
  batFrcOptTn3->canFreeData = false;
  emxFree_real_T(&batFrcOptTn3);
  optPreInxTn3->canFreeData = false;
  emxFree_real_T(&optPreInxTn3);
  emxFreeStruct_struct0_T(&FZG);
  engKinMat_engKinInx_wayInx->canFreeData = false;
  emxFree_real_T(&engKinMat_engKinInx_wayInx);
  slpVec_wayInx->canFreeData = false;
  emxFree_real_T(&slpVec_wayInx);
  engKinNumVec_wayInx->canFreeData = false;
  emxFree_real_T(&engKinNumVec_wayInx);
  emlrtHeapReferenceStackLeaveFcnR2012b(&st);
}
Exemplo n.º 2
0
/* Function Definitions */
void spline(const emxArray_real_T *x, const emxArray_real_T *y, emxArray_real_T *
            output_breaks, emxArray_real_T *output_coefs)
{
  int nx;
  int pglen;
  boolean_T has_endslopes;
  emxArray_real_T *t0_breaks;
  emxArray_real_T *t0_coefs;
  int szdvdf[2];
  int pgm1;
  emxArray_real_T *dx;
  int pgm2;
  int j;
  unsigned int szc[3];
  emxArray_real_T *c;
  double d1;
  double A;
  emxArray_real_T *dvdf;
  emxArray_real_T *s;
  emxArray_real_T *md;
  double d31;
  double dnnm2;
  double dvdf1;
  double b_x[2];
  int szs[2];
  int yoffset;
  int k;
  int pg;
  nx = x->size[0] - 1;
  pglen = y->size[0];
  has_endslopes = (y->size[1] == x->size[0] + 2);
  emxInit_real_T(&t0_breaks, 2);
  c_emxInit_real_T(&t0_coefs, 3);
  if (x->size[0] == 2) {
    if (has_endslopes) {
      for (pgm1 = 0; pgm1 < 2; pgm1++) {
        szdvdf[pgm1] = y->size[pgm1];
      }

      emxInit_real_T(&dx, 2);
      pgm1 = dx->size[0] * dx->size[1];
      dx->size[0] = szdvdf[0];
      dx->size[1] = 2;
      emxEnsureCapacity((emxArray__common *)dx, pgm1, (int)sizeof(double));
      pgm2 = (y->size[1] - 1) * y->size[0];
      for (j = 0; j + 1 <= pglen; j++) {
        dx->data[j] = y->data[j];
        dx->data[pglen + j] = y->data[pgm2 + j];
      }

      pwchcore(x, y, y->size[0], dx, t0_breaks, t0_coefs);
      pgm1 = output_breaks->size[0] * output_breaks->size[1];
      output_breaks->size[0] = 1;
      output_breaks->size[1] = t0_breaks->size[1];
      emxEnsureCapacity((emxArray__common *)output_breaks, pgm1, (int)sizeof
                        (double));
      pgm2 = t0_breaks->size[0] * t0_breaks->size[1];
      emxFree_real_T(&dx);
      for (pgm1 = 0; pgm1 < pgm2; pgm1++) {
        output_breaks->data[pgm1] = t0_breaks->data[pgm1];
      }

      pgm1 = output_coefs->size[0] * output_coefs->size[1] * output_coefs->size
        [2];
      output_coefs->size[0] = t0_coefs->size[0];
      output_coefs->size[1] = t0_coefs->size[1];
      output_coefs->size[2] = 4;
      emxEnsureCapacity((emxArray__common *)output_coefs, pgm1, (int)sizeof
                        (double));
      pgm2 = t0_coefs->size[0] * t0_coefs->size[1] * t0_coefs->size[2];
      for (pgm1 = 0; pgm1 < pgm2; pgm1++) {
        output_coefs->data[pgm1] = t0_coefs->data[pgm1];
      }
    } else {
      for (pgm1 = 0; pgm1 < 2; pgm1++) {
        szc[pgm1] = (unsigned int)y->size[pgm1];
      }

      c_emxInit_real_T(&c, 3);
      pgm1 = c->size[0] * c->size[1] * c->size[2];
      c->size[0] = (int)szc[0];
      c->size[1] = 1;
      c->size[2] = 2;
      emxEnsureCapacity((emxArray__common *)c, pgm1, (int)sizeof(double));
      d1 = x->data[1] - x->data[0];
      for (j = 0; j + 1 <= pglen; j++) {
        A = y->data[pglen + j] - y->data[j];
        c->data[j] = A / d1;
        c->data[pglen + j] = y->data[j];
      }

      emxInit_real_T(&dx, 2);
      pgm1 = dx->size[0] * dx->size[1];
      dx->size[0] = 1;
      dx->size[1] = 2;
      emxEnsureCapacity((emxArray__common *)dx, pgm1, (int)sizeof(double));
      for (pgm1 = 0; pgm1 < 2; pgm1++) {
        dx->data[dx->size[0] * pgm1] = x->data[pgm1];
      }

      pgm1 = output_breaks->size[0] * output_breaks->size[1];
      output_breaks->size[0] = 1;
      output_breaks->size[1] = dx->size[1];
      emxEnsureCapacity((emxArray__common *)output_breaks, pgm1, (int)sizeof
                        (double));
      pgm2 = dx->size[0] * dx->size[1];
      for (pgm1 = 0; pgm1 < pgm2; pgm1++) {
        output_breaks->data[pgm1] = dx->data[pgm1];
      }

      emxFree_real_T(&dx);
      pgm1 = output_coefs->size[0] * output_coefs->size[1] * output_coefs->size
        [2];
      output_coefs->size[0] = c->size[0];
      output_coefs->size[1] = 1;
      output_coefs->size[2] = 2;
      emxEnsureCapacity((emxArray__common *)output_coefs, pgm1, (int)sizeof
                        (double));
      pgm2 = c->size[0] * c->size[1] * c->size[2];
      for (pgm1 = 0; pgm1 < pgm2; pgm1++) {
        output_coefs->data[pgm1] = c->data[pgm1];
      }

      emxFree_real_T(&c);
    }
  } else {
    c_emxInit_real_T(&c, 3);
    b_emxInit_real_T(&dx, 1);
    emxInit_real_T(&dvdf, 2);
    emxInit_real_T(&s, 2);
    b_emxInit_real_T(&md, 1);
    if ((x->size[0] == 3) && (!has_endslopes)) {
      for (pgm1 = 0; pgm1 < 2; pgm1++) {
        szc[pgm1] = (unsigned int)y->size[pgm1];
      }

      pgm1 = c->size[0] * c->size[1] * c->size[2];
      c->size[0] = (int)szc[0];
      c->size[1] = 1;
      c->size[2] = 3;
      emxEnsureCapacity((emxArray__common *)c, pgm1, (int)sizeof(double));
      d31 = x->data[2] - x->data[0];
      d1 = x->data[1] - x->data[0];
      dnnm2 = x->data[2] - x->data[1];
      for (j = 0; j + 1 <= pglen; j++) {
        A = y->data[pglen + j] - y->data[j];
        dvdf1 = A / d1;
        A = y->data[(pglen << 1) + j] - y->data[pglen + j];
        c->data[j] = (A / dnnm2 - dvdf1) / d31;
        c->data[pglen + j] = dvdf1 - c->data[j] * d1;
        c->data[(pglen << 1) + j] = y->data[j];
      }

      b_x[0] = x->data[0];
      b_x[1] = x->data[2];
      pgm1 = output_breaks->size[0] * output_breaks->size[1];
      output_breaks->size[0] = 1;
      output_breaks->size[1] = 2;
      emxEnsureCapacity((emxArray__common *)output_breaks, pgm1, (int)sizeof
                        (double));
      for (pgm1 = 0; pgm1 < 2; pgm1++) {
        output_breaks->data[output_breaks->size[0] * pgm1] = b_x[pgm1];
      }

      pgm1 = output_coefs->size[0] * output_coefs->size[1] * output_coefs->size
        [2];
      output_coefs->size[0] = c->size[0];
      output_coefs->size[1] = 1;
      output_coefs->size[2] = 3;
      emxEnsureCapacity((emxArray__common *)output_coefs, pgm1, (int)sizeof
                        (double));
      pgm2 = c->size[0] * c->size[1] * c->size[2];
      for (pgm1 = 0; pgm1 < pgm2; pgm1++) {
        output_coefs->data[pgm1] = c->data[pgm1];
      }
    } else {
      if (has_endslopes) {
        for (pgm1 = 0; pgm1 < 2; pgm1++) {
          szdvdf[pgm1] = y->size[pgm1];
        }

        szdvdf[1] = y->size[1] - 3;
        for (pgm1 = 0; pgm1 < 2; pgm1++) {
          szs[pgm1] = y->size[pgm1];
        }

        szs[1] = y->size[1] - 2;
        yoffset = y->size[0];
      } else {
        for (pgm1 = 0; pgm1 < 2; pgm1++) {
          szdvdf[pgm1] = y->size[pgm1];
        }

        szdvdf[1] = y->size[1] - 1;
        for (pgm1 = 0; pgm1 < 2; pgm1++) {
          szs[pgm1] = y->size[pgm1];
        }

        yoffset = 0;
      }

      if (1 > x->size[0] - 1) {
        pgm1 = 1;
      } else {
        pgm1 = x->size[0];
      }

      pgm2 = dx->size[0];
      dx->size[0] = pgm1 - 1;
      emxEnsureCapacity((emxArray__common *)dx, pgm2, (int)sizeof(double));
      pgm1 = dvdf->size[0] * dvdf->size[1];
      dvdf->size[0] = szdvdf[0];
      dvdf->size[1] = szdvdf[1];
      emxEnsureCapacity((emxArray__common *)dvdf, pgm1, (int)sizeof(double));
      pgm1 = s->size[0] * s->size[1];
      s->size[0] = szs[0];
      s->size[1] = szs[1];
      emxEnsureCapacity((emxArray__common *)s, pgm1, (int)sizeof(double));
      for (k = 0; k + 1 <= nx; k++) {
        dx->data[k] = x->data[k + 1] - x->data[k];
        pgm1 = k * pglen;
        pg = yoffset + pgm1;
        pgm2 = yoffset + (k + 1) * pglen;
        for (j = 0; j + 1 <= pglen; j++) {
          A = y->data[pgm2 + j] - y->data[pg + j];
          dvdf->data[pgm1 + j] = A / dx->data[k];
        }
      }

      for (k = 1; k + 1 <= nx; k++) {
        pg = k * pglen;
        pgm1 = (k - 1) * pglen;
        for (j = 0; j + 1 <= pglen; j++) {
          s->data[pg + j] = 3.0 * (dx->data[k] * dvdf->data[pgm1 + j] + dx->
            data[k - 1] * dvdf->data[pg + j]);
        }
      }

      if (has_endslopes) {
        d31 = 0.0;
        dnnm2 = 0.0;
        for (j = 0; j + 1 <= pglen; j++) {
          s->data[j] = dx->data[1] * y->data[j];
        }

        pgm2 = (x->size[0] + 1) * y->size[0];
        pgm1 = (x->size[0] - 1) * y->size[0];
        for (j = 0; j + 1 <= pglen; j++) {
          s->data[pgm1 + j] = dx->data[nx - 2] * y->data[pgm2 + j];
        }
      } else {
        d31 = x->data[2] - x->data[0];
        dnnm2 = x->data[x->size[0] - 1] - x->data[x->size[0] - 3];
        d1 = dx->data[0];
        for (j = 0; j + 1 <= pglen; j++) {
          A = (d1 + 2.0 * d31) * dx->data[1] * dvdf->data[j] + d1 * d1 *
            dvdf->data[pglen + j];
          s->data[j] = A / d31;
        }

        pg = (x->size[0] - 1) * y->size[0];
        pgm1 = (x->size[0] - 2) * y->size[0];
        pgm2 = (x->size[0] - 3) * y->size[0];
        d1 = dx->data[x->size[0] - 2];
        for (j = 0; j + 1 <= pglen; j++) {
          A = (d1 + 2.0 * dnnm2) * dx->data[x->size[0] - 3] * dvdf->data[pgm1 +
            j] + d1 * d1 * dvdf->data[pgm2 + j];
          s->data[pg + j] = A / dnnm2;
        }
      }

      pgm1 = md->size[0];
      md->size[0] = x->size[0];
      emxEnsureCapacity((emxArray__common *)md, pgm1, (int)sizeof(double));
      md->data[0] = dx->data[1];
      md->data[x->size[0] - 1] = dx->data[x->size[0] - 3];
      for (k = 1; k + 1 <= nx; k++) {
        md->data[k] = 2.0 * (dx->data[k] + dx->data[k - 1]);
      }

      d1 = dx->data[1] / md->data[0];
      md->data[1] -= d1 * d31;
      for (j = 0; j + 1 <= pglen; j++) {
        s->data[pglen + j] -= d1 * s->data[j];
      }

      for (k = 2; k + 1 <= nx; k++) {
        d1 = dx->data[k] / md->data[k - 1];
        md->data[k] -= d1 * dx->data[k - 2];
        pg = k * pglen;
        pgm1 = (k - 1) * pglen;
        for (j = 0; j + 1 <= pglen; j++) {
          s->data[pg + j] -= d1 * s->data[pgm1 + j];
        }
      }

      d1 = dnnm2 / md->data[x->size[0] - 2];
      md->data[x->size[0] - 1] -= d1 * dx->data[x->size[0] - 3];
      pg = (x->size[0] - 1) * y->size[0];
      pgm1 = (x->size[0] - 2) * y->size[0];
      for (j = 0; j + 1 <= pglen; j++) {
        s->data[pg + j] -= d1 * s->data[pgm1 + j];
      }

      for (j = 0; j + 1 <= pglen; j++) {
        A = s->data[pg + j];
        s->data[pg + j] = A / md->data[nx];
      }

      for (k = x->size[0] - 1; k > 1; k--) {
        pg = (k - 1) * pglen;
        pgm2 = k * pglen;
        for (j = 0; j + 1 <= pglen; j++) {
          A = s->data[pg + j] - dx->data[k - 2] * s->data[pgm2 + j];
          s->data[pg + j] = A / md->data[k - 1];
        }
      }

      for (j = 0; j + 1 <= pglen; j++) {
        A = s->data[j] - d31 * s->data[pglen + j];
        s->data[j] = A / md->data[0];
      }

      b_pwchcore(x, y, yoffset, s, dx, dvdf, t0_breaks, t0_coefs);
      pgm1 = output_breaks->size[0] * output_breaks->size[1];
      output_breaks->size[0] = 1;
      output_breaks->size[1] = t0_breaks->size[1];
      emxEnsureCapacity((emxArray__common *)output_breaks, pgm1, (int)sizeof
                        (double));
      pgm2 = t0_breaks->size[0] * t0_breaks->size[1];
      for (pgm1 = 0; pgm1 < pgm2; pgm1++) {
        output_breaks->data[pgm1] = t0_breaks->data[pgm1];
      }

      pgm1 = output_coefs->size[0] * output_coefs->size[1] * output_coefs->size
        [2];
      output_coefs->size[0] = t0_coefs->size[0];
      output_coefs->size[1] = t0_coefs->size[1];
      output_coefs->size[2] = 4;
      emxEnsureCapacity((emxArray__common *)output_coefs, pgm1, (int)sizeof
                        (double));
      pgm2 = t0_coefs->size[0] * t0_coefs->size[1] * t0_coefs->size[2];
      for (pgm1 = 0; pgm1 < pgm2; pgm1++) {
        output_coefs->data[pgm1] = t0_coefs->data[pgm1];
      }
    }

    emxFree_real_T(&md);
    emxFree_real_T(&s);
    emxFree_real_T(&dvdf);
    emxFree_real_T(&dx);
    emxFree_real_T(&c);
  }

  emxFree_real_T(&t0_coefs);
  emxFree_real_T(&t0_breaks);
}
Exemplo n.º 3
0
/* Function Definitions */
void determineCriterion(struct0_T *p, real_T trial)
{
  emxArray_real_T *b_p;
  int32_T loop_ub;
  int32_T i19;
  emxArray_real_T *c_p;
  int32_T d_p;
  int32_T i20;
  emxArray_real_T *e_p;
  emxArray_real_T *f_p;
  emlrtHeapReferenceStackEnterFcnR2012b(emlrtRootTLSGlobal);

  /* update criterion for use on next trial */
  /*  when two layers are available, each are allowed seperate decision */
  /*  thresholds */
  /*  p.mean_famil_diff(trial) = mean(familDiffs); */
  if (p->numThresh == 2.0) {
    emxInit_real_T(&b_p, 1, true);
    loop_ub = p->usePRC->size[0];
    i19 = b_p->size[0];
    b_p->size[0] = loop_ub;
    emxEnsureCapacity((emxArray__common *)b_p, i19, (int32_T)sizeof(real_T));
    for (i19 = 0; i19 < loop_ub; i19++) {
      b_p->data[i19] = p->usePRC->data[i19 + p->usePRC->size[0] * ((int32_T)
        trial - 1)];
    }

    if (all(b_p)) {
      if (1.0 > (real_T)p->famil_diff_thresh->size[1] - 1.0) {
        loop_ub = -1;
      } else {
        loop_ub = (int32_T)((real_T)p->famil_diff_thresh->size[1] - 1.0) - 1;
      }

      c_emxInit_real_T(&c_p, 2, true);
      d_p = p->famil_diff_thresh->size[1];
      i19 = c_p->size[0] * c_p->size[1];
      c_p->size[0] = 2;
      c_p->size[1] = d_p;
      emxEnsureCapacity((emxArray__common *)c_p, i19, (int32_T)sizeof(real_T));
      for (i19 = 0; i19 < d_p; i19++) {
        c_p->data[c_p->size[0] * i19] = p->famil_diff_thresh->data
          [p->famil_diff_thresh->size[0] * i19];
      }

      c_p->data[1] = p->famil_difference->data[(int32_T)trial - 1];
      for (i19 = 0; i19 <= loop_ub; i19++) {
        c_p->data[1 + c_p->size[0] * (i19 + 1)] = p->famil_diff_thresh->data[1 +
          p->famil_diff_thresh->size[0] * i19];
      }

      i19 = p->famil_diff_thresh->size[0] * p->famil_diff_thresh->size[1];
      p->famil_diff_thresh->size[0] = c_p->size[0];
      p->famil_diff_thresh->size[1] = c_p->size[1];
      emxEnsureCapacity((emxArray__common *)p->famil_diff_thresh, i19, (int32_T)
                        sizeof(real_T));
      loop_ub = c_p->size[1];
      for (i19 = 0; i19 < loop_ub; i19++) {
        d_p = c_p->size[0];
        for (i20 = 0; i20 < d_p; i20++) {
          p->famil_diff_thresh->data[i20 + p->famil_diff_thresh->size[0] * i19] =
            c_p->data[i20 + c_p->size[0] * i19];
        }
      }

      emxFree_real_T(&c_p);
    } else {
      if (1.0 > (real_T)p->famil_diff_thresh->size[1] - 1.0) {
        loop_ub = -1;
      } else {
        loop_ub = (int32_T)((real_T)p->famil_diff_thresh->size[1] - 1.0) - 1;
      }

      c_emxInit_real_T(&e_p, 2, true);
      d_p = p->famil_diff_thresh->size[1] - 1;
      i19 = e_p->size[0] * e_p->size[1];
      e_p->size[0] = 2;
      e_p->size[1] = loop_ub + 2;
      emxEnsureCapacity((emxArray__common *)e_p, i19, (int32_T)sizeof(real_T));
      e_p->data[0] = p->famil_difference->data[(int32_T)trial - 1];
      for (i19 = 0; i19 <= loop_ub; i19++) {
        e_p->data[e_p->size[0] * (i19 + 1)] = p->famil_diff_thresh->data
          [p->famil_diff_thresh->size[0] * i19];
      }

      for (i19 = 0; i19 <= d_p; i19++) {
        e_p->data[1 + e_p->size[0] * i19] = p->famil_diff_thresh->data[1 +
          p->famil_diff_thresh->size[0] * i19];
      }

      i19 = p->famil_diff_thresh->size[0] * p->famil_diff_thresh->size[1];
      p->famil_diff_thresh->size[0] = e_p->size[0];
      p->famil_diff_thresh->size[1] = e_p->size[1];
      emxEnsureCapacity((emxArray__common *)p->famil_diff_thresh, i19, (int32_T)
                        sizeof(real_T));
      loop_ub = e_p->size[1];
      for (i19 = 0; i19 < loop_ub; i19++) {
        d_p = e_p->size[0];
        for (i20 = 0; i20 < d_p; i20++) {
          p->famil_diff_thresh->data[i20 + p->famil_diff_thresh->size[0] * i19] =
            e_p->data[i20 + e_p->size[0] * i19];
        }
      }

      emxFree_real_T(&e_p);

      /*  p.famil_diff_thresh = [p.famil_diff_thresh, p.famil_difference(trial)]; */
      /*      p.threshForPlotting(trial) = mean(p.famil_diff_thresh); */
      /*  p.familDiff_threshTracking(trial) = famil_diff_thresh_new; */
    }

    emxFree_real_T(&b_p);
  } else {
    if (1.0 > (real_T)p->famil_diff_thresh->size[1] - 1.0) {
      loop_ub = -1;
    } else {
      loop_ub = (int32_T)((real_T)p->famil_diff_thresh->size[1] - 1.0) - 1;
    }

    c_emxInit_real_T(&f_p, 2, true);
    d_p = p->famil_diff_thresh->size[1] - 1;
    i19 = f_p->size[0] * f_p->size[1];
    f_p->size[0] = 2;
    f_p->size[1] = loop_ub + 2;
    emxEnsureCapacity((emxArray__common *)f_p, i19, (int32_T)sizeof(real_T));
    f_p->data[0] = p->famil_difference->data[(int32_T)trial - 1];
    for (i19 = 0; i19 <= loop_ub; i19++) {
      f_p->data[f_p->size[0] * (i19 + 1)] = p->famil_diff_thresh->data
        [p->famil_diff_thresh->size[0] * i19];
    }

    for (i19 = 0; i19 <= d_p; i19++) {
      f_p->data[1 + f_p->size[0] * i19] = p->famil_diff_thresh->data[1 +
        p->famil_diff_thresh->size[0] * i19];
    }

    i19 = p->famil_diff_thresh->size[0] * p->famil_diff_thresh->size[1];
    p->famil_diff_thresh->size[0] = f_p->size[0];
    p->famil_diff_thresh->size[1] = f_p->size[1];
    emxEnsureCapacity((emxArray__common *)p->famil_diff_thresh, i19, (int32_T)
                      sizeof(real_T));
    loop_ub = f_p->size[1];
    for (i19 = 0; i19 < loop_ub; i19++) {
      d_p = f_p->size[0];
      for (i20 = 0; i20 < d_p; i20++) {
        p->famil_diff_thresh->data[i20 + p->famil_diff_thresh->size[0] * i19] =
          f_p->data[i20 + f_p->size[0] * i19];
      }
    }

    emxFree_real_T(&f_p);
  }

  emlrtHeapReferenceStackLeaveFcnR2012b(emlrtRootTLSGlobal);
}
Exemplo n.º 4
0
void emxInitStruct_struct0_T(const emlrtStack *sp, struct0_T *pStruct, const
  emlrtRTEInfo *srcLocation, boolean_T doPush)
{
  emxInit_char_T(sp, &pStruct->wd, 2, srcLocation, doPush);
  emxInit_real_T(sp, &pStruct->famil_diff_thresh_start, 1, srcLocation, doPush);
  emxInit_char_T(sp, &pStruct->nameOfFolder, 2, srcLocation, doPush);
  emxInit_char_T(sp, &pStruct->expt, 2, srcLocation, doPush);
  b_emxInit_real_T(sp, &pStruct->gridMat, 3, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->famil_diff_thresh, 2, srcLocation, doPush);
  b_emxInit_real_T(sp, &pStruct->stimuli_misMatch, 3, srcLocation, doPush);
  b_emxInit_real_T(sp, &pStruct->stimuli_match, 3, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->tType, 2, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->stimOrder, 2, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->numGrids, 2, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->nInpDims, 2, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->usePRC, 2, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->meanSelectivity_caudal_new, 2, srcLocation,
                   doPush);
  c_emxInit_real_T(sp, &pStruct->meanSelectivity_PRC_new, 2, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->meanSelectivity_caudal_prev, 2, srcLocation,
                   doPush);
  c_emxInit_real_T(sp, &pStruct->meanSelectivity_PRC_prev, 2, srcLocation,
                   doPush);
  c_emxInit_real_T(sp, &pStruct->familDiff_caudal, 2, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->familDiff_PRC, 2, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->prevStimInit_act_peak, 2, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->prevStimInit_act_total, 2, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->prevStimFin_act_peak, 2, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->prevStimFin_act_total, 2, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->newStimInit_act_peak, 2, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->newStimInit_act_total, 2, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->newStimFin_act_peak, 2, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->newStimFin_act_total, 2, srcLocation, doPush);
  b_emxInit_real_T(sp, &pStruct->featsSampedByComparison, 3, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->sample_feat, 2, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->fixations, 2, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->peak_act, 2, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->totalAct, 2, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->comparedFeat, 2, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->familDiff_withNoise, 2, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->famil_difference, 2, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->answer, 2, srcLocation, doPush);
  c_emxInit_real_T(sp, &pStruct->correct, 2, srcLocation, doPush);
}