Use function handle in MEX file (serialize it)
Show older comments
What sorts of things can one do with a function handle in a MEX file?
What I'd like to do is extract all the relevant data from an mxArray that represents a function handle in such a way that I could create a different mxArray that will represent the same function handle.
In other words, I'd need to serialize an mxArray function handle.
I need this while building a bridge between MATLAB and another language. I would like to support classes in MATLAB. I can take apart just about any other kind of mxArray and put them back together as there exist mx* functions for these (e.g. mxGetData() for numerical arrays, etc.) So far it's only function handles I couldn't cope with.
EDIT: For this application I can always keep a dictionary of available function handles. I do not need or want to expose the underlying data (which may be a pointer, thus unsafe). But in order to keep a dictionary, I need to be able to at least compare function handles: do two mxArray refer to the same function handle?
Accepted Answer
More Answers (0)
Categories
Find more on Data Type Identification in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!