Make a function named mex_function() and put your code inside it. Note that the return type should be void. Use non-const reference arguments to return outputs. Finally, mex_function() must have no more than 20 arguments.
| 63 | // arguments to return outputs. Finally, mex_function() must have no |
| 64 | // more than 20 arguments. |
| 65 | void mex_function ( |
| 66 | const matrix_colmajor& x, |
| 67 | const matrix_colmajor& y, |
| 68 | matrix_colmajor& out1, |
| 69 | double& out2, |
| 70 | double some_number |
| 71 | ) |
| 72 | { |
| 73 | out1 = x + y; |
| 74 | out2 = sum(x+y); |
| 75 | |
| 76 | // we can also use cout to print things as usual: |
| 77 | cout << "some_number: "<< some_number << endl; |
| 78 | } |
| 79 | |
| 80 | |
| 81 |