matlab internal problem and needs to close - reading from dll in MEX
2 views (last 30 days)
Show older comments
I am working a a project where I have to make a Matlab interface for IR tracking software. (www.free-track.net). FreeTrack provides a SDK in their download with Matlab code which makes a MEX file from C code. The C code reads from a dll called "freetrackClient.dll", which holds the tracking data. When I run FreeTrack and track my head movement, the data of my movement can be seen on the screen.
Now I want to read this data and save it into Matlab. However, when i run the funciton getData, Matlab crashes and says: "MATLAB has encountered a problem and needs to close"
?Why can't i read from the DLL?
2 Comments
Ken Atwell
on 15 Feb 2012
Are you using loadlibrary? Can you add a code fragment (i.e., the MATLAB code you are running that causes the crash)?
Answers (1)
Ken Atwell
on 15 Feb 2012
Double-check that you've initialized plhs[0] with mxCreateStructArray with at least the seven fields that you reference later one.
When in doubt, start with a working example and modify incrementally from there:
edit([matlabroot '/extern/examples/mx/mxcreatestructarray.c']);
See Also
Categories
Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!