Code using C++ works outside of mexFunction but not the same within a mexFunction?

1 view (last 30 days)
Dejan Dimitrijevic
Dejan Dimitrijevic on 16 Jun 2019
Edited: Dejan Dimitrijevic on 4 Jul 2019
Hello,
I have some code that when compiled as a standalone .exe works just fine, but when compiled as a mex won't return the same result, and it's just when it's supposed to call the getColors() C++ Kinect v2 SDK method which should set an int* pColors variable passed via an address to the aforementioned method (and it should return bit packed values in an integer with first eight bits being 1 and the rest belonging to three RGB 8-bit values, which although set fine in standalone C++, are just always 0s when in mex)...I have attached the .zip demonstrating the problem and would appreciate any help in realizing why it doesn't work witihin a MATLAB mexFunction...is MATLAB unable to somehow set a double pointer's value or what (although the color bytes contain eight zeros first and after 24 zeros meaning at least some values are set albeit set to zero or all would be the same 1s probably)?
TIA
P.S.
To run the code setting any values you will need a Kinect v2 sensor with the Kinect v2 SDK installed or you can use SDK's Kinect Studio to playback a pre-recorded .xef file like this one...

Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!