File: nullAssignment.c1 /* 2 * nullAssignment.c 3 * 4 * Code generation for function 'nullAssignment' 5 * 6 */ 7 8 /* Include files */ 9 #include "rt_nonfinite.h" 10 #include "Datalogger4ChConverter_ErrInsensitiveSound.h" 11 #include "nullAssignment.h" 12 #include "Datalogger4ChConverter_ErrInsensitiveSound_emxutil.h" 13 #include "eml_int_forloop_overflow_check.h" 14 #include "Datalogger4ChConverter_ErrInsensitiveSound_data.h" 15 #include <stdio.h> 16 17 /* Variable Definitions */ 18 static emlrtRSInfo v_emlrtRSI = { 19, "nullAssignment", 19 "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\eml\\+coder\\+internal\\nullAssignment.m" 20 }; 21 22 static emlrtRSInfo w_emlrtRSI = { 23, "nullAssignment", 23 "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\eml\\+coder\\+internal\\nullAssignment.m" 24 }; 25 26 static emlrtRSInfo x_emlrtRSI = { 279, "nullAssignment", 27 "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\eml\\+coder\\+internal\\nullAssignment.m" 28 }; 29 30 static emlrtRSInfo y_emlrtRSI = { 281, "nullAssignment", 31 "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\eml\\+coder\\+internal\\nullAssignment.m" 32 }; 33 34 static emlrtRSInfo ab_emlrtRSI = { 284, "nullAssignment", 35 "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\eml\\+coder\\+internal\\nullAssignment.m" 36 }; 37 38 static emlrtRSInfo bb_emlrtRSI = { 255, "nullAssignment", 39 "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\eml\\+coder\\+internal\\nullAssignment.m" 40 }; 41 42 static emlrtRSInfo db_emlrtRSI = { 128, "nullAssignment", 43 "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\eml\\+coder\\+internal\\nullAssignment.m" 44 }; 45 46 static emlrtRTEInfo i_emlrtRTEI = { 1, 14, "nullAssignment", 47 "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\eml\\+coder\\+internal\\nullAssignment.m" 48 }; 49 50 static emlrtRTEInfo j_emlrtRTEI = { 250, 14, "nullAssignment", 51 "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\eml\\+coder\\+internal\\nullAssignment.m" 52 }; 53 54 static emlrtRTEInfo l_emlrtRTEI = { 277, 9, "nullAssignment", 55 "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\eml\\+coder\\+internal\\nullAssignment.m" 56 }; 57 58 static emlrtRTEInfo u_emlrtRTEI = { 293, 1, "nullAssignment", 59 "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\eml\\+coder\\+internal\\nullAssignment.m" 60 }; 61 62 static emlrtRTEInfo v_emlrtRTEI = { 77, 27, "nullAssignment", 63 "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\eml\\+coder\\+internal\\nullAssignment.m" 64 }; 65 66 /* Function Declarations */ 67 static void make_bitarray(const emlrtStack *sp, int32_T n, const 68 emxArray_int32_T *idx, emxArray_boolean_T *b); 69 static int32_T num_true(const emlrtStack *sp, const emxArray_boolean_T *b); 70 71 /* Function Definitions */ 72 static void make_bitarray(const emlrtStack *sp, int32_T n, const 73 emxArray_int32_T *idx, emxArray_boolean_T *b) 74 { 75 int32_T k; 76 boolean_T overflow; 77 emlrtStack st; 78 emlrtStack b_st; 79 st.prev = sp; 80 st.tls = sp->tls; 81 b_st.prev = &st; 82 b_st.tls = st.tls; 83 k = b->size[0] * b->size[1]; 84 b->size[0] = 1; 85 b->size[1] = n; 86 emxEnsureCapacity(sp, (emxArray__common *)b, k, (int32_T)sizeof(boolean_T), 87 &j_emlrtRTEI); 88 for (k = 0; k < n; k++) { 89 b->data[k] = false; 90 } 91 92 st.site = &bb_emlrtRSI; 93 overflow = ((!(1 > idx->size[1])) && (idx->size[1] > 2147483646)); 94 if (overflow) { 95 b_st.site = &cb_emlrtRSI; 96 check_forloop_overflow_error(&b_st); 97 } 98 99 for (k = 1; k <= idx->size[1]; k++) { 100 b->data[idx->data[k - 1] - 1] = true; 101 } 102 } 103 104 static int32_T num_true(const emlrtStack *sp, const emxArray_boolean_T *b) 105 { 106 int32_T n; 107 boolean_T overflow; 108 int32_T k; 109 emlrtStack st; 110 emlrtStack b_st; 111 st.prev = sp; 112 st.tls = sp->tls; 113 b_st.prev = &st; 114 b_st.tls = st.tls; 115 n = 0; 116 st.site = &db_emlrtRSI; 117 overflow = ((!(1 > b->size[1])) && (b->size[1] > 2147483646)); 118 if (overflow) { 119 b_st.site = &cb_emlrtRSI; 120 check_forloop_overflow_error(&b_st); 121 } 122 123 for (k = 1; k <= b->size[1]; k++) { 124 n += b->data[k - 1]; 125 } 126 127 return n; 128 } 129 130 void b_nullAssignment(const emlrtStack *sp, emxArray_uint8_T *x, const 131 emxArray_int32_T *idx) 132 { 133 boolean_T overflow; 134 int32_T k; 135 boolean_T exitg1; 136 int32_T nrowx; 137 emxArray_boolean_T *b; 138 int32_T nrows; 139 int32_T i; 140 emxArray_uint8_T *b_x; 141 emlrtStack st; 142 emlrtStack b_st; 143 emlrtStack c_st; 144 st.prev = sp; 145 st.tls = sp->tls; 146 b_st.prev = &st; 147 b_st.tls = st.tls; 148 c_st.prev = &b_st; 149 c_st.tls = b_st.tls; 150 emlrtHeapReferenceStackEnterFcnR2012b(sp); 151 st.site = &v_emlrtRSI; 152 overflow = true; 153 k = 0; 154 exitg1 = false; 155 while ((!exitg1) && (k <= idx->size[1] - 1)) { 156 if ((idx->data[k] < 1) || (idx->data[k] > x->size[0])) { 157 overflow = false; 158 exitg1 = true; 159 } else { 160 k++; 161 } 162 } 163 164 if (overflow) { 165 } else { 166 emlrtErrorWithMessageIdR2012b(&st, &v_emlrtRTEI, "MATLAB:subsdeldimmismatch", 167 0); 168 } 169 170 st.site = &w_emlrtRSI; 171 nrowx = x->size[0]; 172 if (idx->size[1] == 1) { 173 nrows = x->size[0] - 1; 174 for (i = idx->data[0]; i < nrowx; i++) { 175 x->data[i - 1] = x->data[i]; 176 } 177 } else { 178 emxInit_boolean_T(&st, &b, 2, &l_emlrtRTEI, true); 179 b_st.site = &x_emlrtRSI; 180 make_bitarray(&b_st, x->size[0], idx, b); 181 b_st.site = &y_emlrtRSI; 182 nrows = x->size[0] - num_true(&b_st, b); 183 i = 0; 184 b_st.site = &ab_emlrtRSI; 185 overflow = ((!(1 > x->size[0])) && (x->size[0] > 2147483646)); 186 if (overflow) { 187 c_st.site = &cb_emlrtRSI; 188 check_forloop_overflow_error(&c_st); 189 } 190 191 for (k = 1; k <= nrowx; k++) { 192 if ((k > b->size[1]) || (!b->data[k - 1])) { 193 x->data[i] = x->data[k - 1]; 194 i++; 195 } 196 } 197 198 emxFree_boolean_T(&b); 199 } 200 201 if (nrows <= nrowx) { 202 } else { 203 emlrtErrorWithMessageIdR2012b(&st, &u_emlrtRTEI, 204 "Coder:builtins:AssertionFailed", 0); 205 } 206 207 if (1 > nrows) { 208 k = 0; 209 } else { 210 k = nrows; 211 } 212 213 emxInit_uint8_T(&st, &b_x, 1, &i_emlrtRTEI, true); 214 nrowx = b_x->size[0]; 215 b_x->size[0] = k; 216 emxEnsureCapacity(&st, (emxArray__common *)b_x, nrowx, (int32_T)sizeof(uint8_T), 217 &i_emlrtRTEI); 218 for (nrowx = 0; nrowx < k; nrowx++) { 219 b_x->data[nrowx] = x->data[nrowx]; 220 } 221 222 nrowx = x->size[0]; 223 x->size[0] = b_x->size[0]; 224 emxEnsureCapacity(&st, (emxArray__common *)x, nrowx, (int32_T)sizeof(uint8_T), 225 &i_emlrtRTEI); 226 k = b_x->size[0]; 227 for (nrowx = 0; nrowx < k; nrowx++) { 228 x->data[nrowx] = b_x->data[nrowx]; 229 } 230 231 emxFree_uint8_T(&b_x); 232 emlrtHeapReferenceStackLeaveFcnR2012b(sp); 233 } 234 235 void nullAssignment(const emlrtStack *sp, emxArray_real_T *x, const 236 emxArray_int32_T *idx) 237 { 238 boolean_T overflow; 239 int32_T k; 240 boolean_T exitg1; 241 int32_T nrowx; 242 emxArray_boolean_T *b; 243 int32_T nrows; 244 int32_T j; 245 int32_T i; 246 emxArray_real_T *b_x; 247 emlrtStack st; 248 emlrtStack b_st; 249 emlrtStack c_st; 250 st.prev = sp; 251 st.tls = sp->tls; 252 b_st.prev = &st; 253 b_st.tls = st.tls; 254 c_st.prev = &b_st; 255 c_st.tls = b_st.tls; 256 emlrtHeapReferenceStackEnterFcnR2012b(sp); 257 st.site = &v_emlrtRSI; 258 overflow = true; 259 k = 0; 260 exitg1 = false; 261 while ((!exitg1) && (k <= idx->size[1] - 1)) { 262 if ((idx->data[k] < 1) || (idx->data[k] > x->size[0])) { 263 overflow = false; 264 exitg1 = true; 265 } else { 266 k++; 267 } 268 } 269 270 if (overflow) { 271 } else { 272 emlrtErrorWithMessageIdR2012b(&st, &v_emlrtRTEI, "MATLAB:subsdeldimmismatch", 273 0); 274 } 275 276 st.site = &w_emlrtRSI; 277 nrowx = x->size[0]; 278 if (idx->size[1] == 1) { 279 nrows = x->size[0] - 1; 280 for (j = 0; j < 2; j++) { 281 for (i = idx->data[0]; i < nrowx; i++) { 282 x->data[(i + x->size[0] * j) - 1] = x->data[i + x->size[0] * j]; 283 } 284 } 285 } else { 286 emxInit_boolean_T(&st, &b, 2, &l_emlrtRTEI, true); 287 b_st.site = &x_emlrtRSI; 288 make_bitarray(&b_st, x->size[0], idx, b); 289 b_st.site = &y_emlrtRSI; 290 nrows = x->size[0] - num_true(&b_st, b); 291 i = 0; 292 b_st.site = &ab_emlrtRSI; 293 overflow = ((!(1 > x->size[0])) && (x->size[0] > 2147483646)); 294 if (overflow) { 295 c_st.site = &cb_emlrtRSI; 296 check_forloop_overflow_error(&c_st); 297 } 298 299 for (k = 1; k <= nrowx; k++) { 300 if ((k > b->size[1]) || (!b->data[k - 1])) { 301 for (j = 0; j < 2; j++) { 302 x->data[i + x->size[0] * j] = x->data[(k + x->size[0] * j) - 1]; 303 } 304 305 i++; 306 } 307 } 308 309 emxFree_boolean_T(&b); 310 } 311 312 if (nrows <= nrowx) { 313 } else { 314 emlrtErrorWithMessageIdR2012b(&st, &u_emlrtRTEI, 315 "Coder:builtins:AssertionFailed", 0); 316 } 317 318 if (1 > nrows) { 319 k = 0; 320 } else { 321 k = nrows; 322 } 323 324 emxInit_real_T(&st, &b_x, 2, &i_emlrtRTEI, true); 325 nrowx = b_x->size[0] * b_x->size[1]; 326 b_x->size[0] = k; 327 b_x->size[1] = 2; 328 emxEnsureCapacity(&st, (emxArray__common *)b_x, nrowx, (int32_T)sizeof(real_T), 329 &i_emlrtRTEI); 330 for (nrowx = 0; nrowx < 2; nrowx++) { 331 for (nrows = 0; nrows < k; nrows++) { 332 b_x->data[nrows + b_x->size[0] * nrowx] = x->data[nrows + x->size[0] * 333 nrowx]; 334 } 335 } 336 337 nrowx = x->size[0] * x->size[1]; 338 x->size[0] = b_x->size[0]; 339 x->size[1] = 2; 340 emxEnsureCapacity(&st, (emxArray__common *)x, nrowx, (int32_T)sizeof(real_T), 341 &i_emlrtRTEI); 342 for (nrowx = 0; nrowx < 2; nrowx++) { 343 k = b_x->size[0]; 344 for (nrows = 0; nrows < k; nrows++) { 345 x->data[nrows + x->size[0] * nrowx] = b_x->data[nrows + b_x->size[0] * 346 nrowx]; 347 } 348 } 349 350 emxFree_real_T(&b_x); 351 emlrtHeapReferenceStackLeaveFcnR2012b(sp); 352 } 353 354 /* End of code generation (nullAssignment.c) */ 355 |