| 24 | |
| 25 | |
| 26 | void mex_function ( |
| 27 | const matlab_struct& input, |
| 28 | matlab_struct& output |
| 29 | ) |
| 30 | { |
| 31 | int val = input["val"]; |
| 32 | string stuff = input["stuff"]; |
| 33 | |
| 34 | if (input.has_field("val2")) |
| 35 | { |
| 36 | string val2 = input["val2"]; |
| 37 | cout << "The optional val2 field was set to: " << val2 << endl; |
| 38 | } |
| 39 | |
| 40 | cout << "val: "<< val << endl; |
| 41 | cout << "stuff: " << stuff << endl; |
| 42 | |
| 43 | output["number"] = 999; |
| 44 | |
| 45 | output["number2"] = 1000; |
| 46 | output["sub"]["stuff"] = "some other string"; |
| 47 | matrix<double> m = randm(2,2); |
| 48 | output["sub"]["some_matrix"] = m; |
| 49 | } |
| 50 | |
| 51 | |
| 52 | |