How to convert my mexFunction into external C function for Matlab Coder

3 次查看(过去 30 天)
I have a mexFunction C source code that does json decoding, I was using it with coder.extrinsic but I just got to know that extrinsic functions cannot be used in Standalone Code Generation to C.
I want to convert this mexFunction code such that I can call it using coder.ceval
Do I need to remove all the mxArray, mxCreateStructMatrix types and use plain C data types, or is there a way to keep the current implementation of the mexFunction and get away with making minimal changes to make it an external function?
My input is a json string, and my output is a complicated structure similar to what jsondecode would give in matlab.

采纳的回答

Mukund Sankaran
Mukund Sankaran 2024-1-9
Yes, you would need to write your own function that doesn't use the mx* data types, so it can be invoked via coder.ceval.
It looks like you would benefit from jsondecode being supported by MATLAB Coder directly, but unfortunately, that is not the case as of MATLAB R2023b. We've made an internal note of your request so we can look at lifting that limitation in the future.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Coder 的更多信息

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by