return the pointer or the structure of C structure in C mex file
2 次查看(过去 30 天)
显示 更早的评论
Hi
I have a C function inside a mex file that return a large structure ( 110 fields ), and I want to return this structure to matlab , so , my question is how to copy or to return the pointer of the C structure to Matlab ?
thanks in advance
0 个评论
回答(1 个)
Guillaume
2015-3-2
You can't, matlab does not understand C structures. You'll have to convert your structure to a matlab structure (which is a very different beast). See mxcreatestructarray and mxsetfield to create matlab structs.
3 个评论
Guillaume
2015-3-2
Unless all the fields are the same type, I don't see any other way but to copy each field one by one I'm afraid.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!