File: sum.c

    1   /*
    2    * sum.c
    3    *
    4    * Code generation for function 'sum'
    5    *
    6    */
    7   
    8   /* Include files */
    9   #include "rt_nonfinite.h"
   10   #include "Datalogger4ChConverter_ErrInsensitiveSound.h"
   11   #include "sum.h"
   12   #include <stdio.h>
   13   
   14   /* Variable Definitions */
   15   static emlrtRSInfo eb_emlrtRSI = { 9, "sum",
   16     "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\lib\\matlab\\datafun\\sum.m"
   17   };
   18   
   19   static emlrtRTEInfo s_emlrtRTEI = { 20, 15, "sumprod",
   20     "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\lib\\matlab\\datafun\\private\\sumprod.m"
   21   };
   22   
   23   static emlrtRTEInfo t_emlrtRTEI = { 48, 9, "sumprod",
   24     "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\lib\\matlab\\datafun\\private\\sumprod.m"
   25   };
   26   
   27   /* Function Definitions */
   28   real_T sum(const emlrtStack *sp, const emxArray_real_T *x)
   29   {
   30     real_T y;
   31     boolean_T p;
   32     boolean_T b_p;
   33     int32_T k;
   34     int32_T exitg1;
   35     int32_T i6;
   36     emlrtStack st;
   37     st.prev = sp;
   38     st.tls = sp->tls;
   39     st.site = &eb_emlrtRSI;
   40     if ((x->size[0] == 1) || (x->size[0] != 1)) {
   41       p = true;
   42     } else {
   43       p = false;
   44     }
   45   
   46     if (p) {
   47     } else {
   48       emlrtErrorWithMessageIdR2012b(&st, &s_emlrtRTEI,
   49         "Coder:toolbox:autoDimIncompatibility", 0);
   50     }
   51   
   52     p = false;
   53     b_p = false;
   54     k = 0;
   55     do {
   56       exitg1 = 0;
   57       if (k < 2) {
   58         if (k + 1 <= 1) {
   59           i6 = x->size[0];
   60         } else {
   61           i6 = 1;
   62         }
   63   
   64         if (i6 != 0) {
   65           exitg1 = 1;
   66         } else {
   67           k++;
   68         }
   69       } else {
   70         b_p = true;
   71         exitg1 = 1;
   72       }
   73     } while (exitg1 == 0);
   74   
   75     if (!b_p) {
   76     } else {
   77       p = true;
   78     }
   79   
   80     if (!p) {
   81     } else {
   82       emlrtErrorWithMessageIdR2012b(&st, &t_emlrtRTEI,
   83         "Coder:toolbox:UnsupportedSpecialEmpty", 0);
   84     }
   85   
   86     if (x->size[0] == 0) {
   87       y = 0.0;
   88     } else {
   89       y = x->data[0];
   90       for (k = 2; k <= x->size[0]; k++) {
   91         y += x->data[k - 1];
   92       }
   93     }
   94   
   95     return y;
   96   }
   97   
   98   /* End of code generation (sum.c) */
   99