Mohsen Samadani
/
Algorithm-testing
Code for measuring the signal with a specified length and sampling rate, and saving it on a SD card.
Envelope/envSignal_emxAPI.cpp@1:a514e4de034d, 2017-07-14 (annotated)
- Committer:
- msamadani
- Date:
- Fri Jul 14 14:41:10 2017 +0000
- Revision:
- 1:a514e4de034d
envSignal function works.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
msamadani | 1:a514e4de034d | 1 | // |
msamadani | 1:a514e4de034d | 2 | // Academic License - for use in teaching, academic research, and meeting |
msamadani | 1:a514e4de034d | 3 | // course requirements at degree granting institutions only. Not for |
msamadani | 1:a514e4de034d | 4 | // government, commercial, or other organizational use. |
msamadani | 1:a514e4de034d | 5 | // File: envSignal_emxAPI.cpp |
msamadani | 1:a514e4de034d | 6 | // |
msamadani | 1:a514e4de034d | 7 | // MATLAB Coder version : 3.3 |
msamadani | 1:a514e4de034d | 8 | // C/C++ source code generated on : 13-Jul-2017 15:47:47 |
msamadani | 1:a514e4de034d | 9 | // |
msamadani | 1:a514e4de034d | 10 | |
msamadani | 1:a514e4de034d | 11 | // Include Files |
msamadani | 1:a514e4de034d | 12 | #include "envSignal.h" |
msamadani | 1:a514e4de034d | 13 | #include "envSignal_emxAPI.h" |
msamadani | 1:a514e4de034d | 14 | #include "envSignal_emxutil.h" |
msamadani | 1:a514e4de034d | 15 | |
msamadani | 1:a514e4de034d | 16 | // Function Definitions |
msamadani | 1:a514e4de034d | 17 | |
msamadani | 1:a514e4de034d | 18 | // |
msamadani | 1:a514e4de034d | 19 | // Arguments : int numDimensions |
msamadani | 1:a514e4de034d | 20 | // int *size |
msamadani | 1:a514e4de034d | 21 | // Return Type : emxArray_real32_T * |
msamadani | 1:a514e4de034d | 22 | // |
msamadani | 1:a514e4de034d | 23 | emxArray_real32_T *emxCreateND_real32_T(int numDimensions, int *size) |
msamadani | 1:a514e4de034d | 24 | { |
msamadani | 1:a514e4de034d | 25 | emxArray_real32_T *emx; |
msamadani | 1:a514e4de034d | 26 | int numEl; |
msamadani | 1:a514e4de034d | 27 | int i; |
msamadani | 1:a514e4de034d | 28 | emxInit_real32_T(&emx, numDimensions); |
msamadani | 1:a514e4de034d | 29 | numEl = 1; |
msamadani | 1:a514e4de034d | 30 | for (i = 0; i < numDimensions; i++) { |
msamadani | 1:a514e4de034d | 31 | numEl *= size[i]; |
msamadani | 1:a514e4de034d | 32 | emx->size[i] = size[i]; |
msamadani | 1:a514e4de034d | 33 | } |
msamadani | 1:a514e4de034d | 34 | |
msamadani | 1:a514e4de034d | 35 | emx->data = (float *)calloc((unsigned int)numEl, sizeof(float)); |
msamadani | 1:a514e4de034d | 36 | emx->numDimensions = numDimensions; |
msamadani | 1:a514e4de034d | 37 | emx->allocatedSize = numEl; |
msamadani | 1:a514e4de034d | 38 | return emx; |
msamadani | 1:a514e4de034d | 39 | } |
msamadani | 1:a514e4de034d | 40 | |
msamadani | 1:a514e4de034d | 41 | // |
msamadani | 1:a514e4de034d | 42 | // Arguments : float *data |
msamadani | 1:a514e4de034d | 43 | // int numDimensions |
msamadani | 1:a514e4de034d | 44 | // int *size |
msamadani | 1:a514e4de034d | 45 | // Return Type : emxArray_real32_T * |
msamadani | 1:a514e4de034d | 46 | // |
msamadani | 1:a514e4de034d | 47 | emxArray_real32_T *emxCreateWrapperND_real32_T(float *data, int numDimensions, |
msamadani | 1:a514e4de034d | 48 | int *size) |
msamadani | 1:a514e4de034d | 49 | { |
msamadani | 1:a514e4de034d | 50 | emxArray_real32_T *emx; |
msamadani | 1:a514e4de034d | 51 | int numEl; |
msamadani | 1:a514e4de034d | 52 | int i; |
msamadani | 1:a514e4de034d | 53 | emxInit_real32_T(&emx, numDimensions); |
msamadani | 1:a514e4de034d | 54 | numEl = 1; |
msamadani | 1:a514e4de034d | 55 | for (i = 0; i < numDimensions; i++) { |
msamadani | 1:a514e4de034d | 56 | numEl *= size[i]; |
msamadani | 1:a514e4de034d | 57 | emx->size[i] = size[i]; |
msamadani | 1:a514e4de034d | 58 | } |
msamadani | 1:a514e4de034d | 59 | |
msamadani | 1:a514e4de034d | 60 | emx->data = data; |
msamadani | 1:a514e4de034d | 61 | emx->numDimensions = numDimensions; |
msamadani | 1:a514e4de034d | 62 | emx->allocatedSize = numEl; |
msamadani | 1:a514e4de034d | 63 | emx->canFreeData = false; |
msamadani | 1:a514e4de034d | 64 | return emx; |
msamadani | 1:a514e4de034d | 65 | } |
msamadani | 1:a514e4de034d | 66 | |
msamadani | 1:a514e4de034d | 67 | // |
msamadani | 1:a514e4de034d | 68 | // Arguments : float *data |
msamadani | 1:a514e4de034d | 69 | // int rows |
msamadani | 1:a514e4de034d | 70 | // int cols |
msamadani | 1:a514e4de034d | 71 | // Return Type : emxArray_real32_T * |
msamadani | 1:a514e4de034d | 72 | // |
msamadani | 1:a514e4de034d | 73 | emxArray_real32_T *emxCreateWrapper_real32_T(float *data, int rows, int cols) |
msamadani | 1:a514e4de034d | 74 | { |
msamadani | 1:a514e4de034d | 75 | emxArray_real32_T *emx; |
msamadani | 1:a514e4de034d | 76 | int size[2]; |
msamadani | 1:a514e4de034d | 77 | int numEl; |
msamadani | 1:a514e4de034d | 78 | int i; |
msamadani | 1:a514e4de034d | 79 | size[0] = rows; |
msamadani | 1:a514e4de034d | 80 | size[1] = cols; |
msamadani | 1:a514e4de034d | 81 | emxInit_real32_T(&emx, 2); |
msamadani | 1:a514e4de034d | 82 | numEl = 1; |
msamadani | 1:a514e4de034d | 83 | for (i = 0; i < 2; i++) { |
msamadani | 1:a514e4de034d | 84 | numEl *= size[i]; |
msamadani | 1:a514e4de034d | 85 | emx->size[i] = size[i]; |
msamadani | 1:a514e4de034d | 86 | } |
msamadani | 1:a514e4de034d | 87 | |
msamadani | 1:a514e4de034d | 88 | emx->data = data; |
msamadani | 1:a514e4de034d | 89 | emx->numDimensions = 2; |
msamadani | 1:a514e4de034d | 90 | emx->allocatedSize = numEl; |
msamadani | 1:a514e4de034d | 91 | emx->canFreeData = false; |
msamadani | 1:a514e4de034d | 92 | return emx; |
msamadani | 1:a514e4de034d | 93 | } |
msamadani | 1:a514e4de034d | 94 | |
msamadani | 1:a514e4de034d | 95 | // |
msamadani | 1:a514e4de034d | 96 | // Arguments : int rows |
msamadani | 1:a514e4de034d | 97 | // int cols |
msamadani | 1:a514e4de034d | 98 | // Return Type : emxArray_real32_T * |
msamadani | 1:a514e4de034d | 99 | // |
msamadani | 1:a514e4de034d | 100 | emxArray_real32_T *emxCreate_real32_T(int rows, int cols) |
msamadani | 1:a514e4de034d | 101 | { |
msamadani | 1:a514e4de034d | 102 | emxArray_real32_T *emx; |
msamadani | 1:a514e4de034d | 103 | int size[2]; |
msamadani | 1:a514e4de034d | 104 | int numEl; |
msamadani | 1:a514e4de034d | 105 | int i; |
msamadani | 1:a514e4de034d | 106 | size[0] = rows; |
msamadani | 1:a514e4de034d | 107 | size[1] = cols; |
msamadani | 1:a514e4de034d | 108 | emxInit_real32_T(&emx, 2); |
msamadani | 1:a514e4de034d | 109 | numEl = 1; |
msamadani | 1:a514e4de034d | 110 | for (i = 0; i < 2; i++) { |
msamadani | 1:a514e4de034d | 111 | numEl *= size[i]; |
msamadani | 1:a514e4de034d | 112 | emx->size[i] = size[i]; |
msamadani | 1:a514e4de034d | 113 | } |
msamadani | 1:a514e4de034d | 114 | |
msamadani | 1:a514e4de034d | 115 | emx->data = (float *)calloc((unsigned int)numEl, sizeof(float)); |
msamadani | 1:a514e4de034d | 116 | emx->numDimensions = 2; |
msamadani | 1:a514e4de034d | 117 | emx->allocatedSize = numEl; |
msamadani | 1:a514e4de034d | 118 | return emx; |
msamadani | 1:a514e4de034d | 119 | } |
msamadani | 1:a514e4de034d | 120 | |
msamadani | 1:a514e4de034d | 121 | // |
msamadani | 1:a514e4de034d | 122 | // Arguments : emxArray_real32_T *emxArray |
msamadani | 1:a514e4de034d | 123 | // Return Type : void |
msamadani | 1:a514e4de034d | 124 | // |
msamadani | 1:a514e4de034d | 125 | void emxDestroyArray_real32_T(emxArray_real32_T *emxArray) |
msamadani | 1:a514e4de034d | 126 | { |
msamadani | 1:a514e4de034d | 127 | emxFree_real32_T(&emxArray); |
msamadani | 1:a514e4de034d | 128 | } |
msamadani | 1:a514e4de034d | 129 | |
msamadani | 1:a514e4de034d | 130 | // |
msamadani | 1:a514e4de034d | 131 | // Arguments : emxArray_real32_T **pEmxArray |
msamadani | 1:a514e4de034d | 132 | // int numDimensions |
msamadani | 1:a514e4de034d | 133 | // Return Type : void |
msamadani | 1:a514e4de034d | 134 | // |
msamadani | 1:a514e4de034d | 135 | void emxInitArray_real32_T(emxArray_real32_T **pEmxArray, int numDimensions) |
msamadani | 1:a514e4de034d | 136 | { |
msamadani | 1:a514e4de034d | 137 | emxInit_real32_T(pEmxArray, numDimensions); |
msamadani | 1:a514e4de034d | 138 | } |
msamadani | 1:a514e4de034d | 139 | |
msamadani | 1:a514e4de034d | 140 | // |
msamadani | 1:a514e4de034d | 141 | // File trailer for envSignal_emxAPI.cpp |
msamadani | 1:a514e4de034d | 142 | // |
msamadani | 1:a514e4de034d | 143 | // [EOF] |
msamadani | 1:a514e4de034d | 144 | // |
msamadani | 1:a514e4de034d | 145 |