| 22 | void Arrayvec2mxArray(const Array<vec> &in, mxArray *out) |
| 23 | { |
| 24 | int rows, cols, r, c; |
| 25 | |
| 26 | double* temp = (double *) mxGetPr(out); |
| 27 | if (temp == 0) mexErrMsgTxt("mat2mxArray: Pointer to data is NULL"); |
| 28 | |
| 29 | cols = in.size(); |
| 30 | if (cols == 0) mexErrMsgTxt("mat2mxArray: Data has zero columns"); |
| 31 | |
| 32 | rows = in(0).length(); //length of the first vec |
| 33 | if (rows == 0) mexErrMsgTxt("mat2mxArray: Data has zero rows"); |
| 34 | |
| 35 | for (c = 0; c < cols; c++) { |
| 36 | for (r = 0; r < rows; r++) { |
| 37 | *temp++ = in(c)(r); |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | } |