MCPcopy Create free account
hub / github.com/davisking/dlib / mex_function

Function mex_function

dlib/matlab/example_mex_struct.cpp:26–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24
25
26void 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

Callers

nothing calls this directly

Calls 2

has_fieldMethod · 0.80
randmFunction · 0.50

Tested by

no test coverage detected