How to manually edit MatLab Coder .mex-file code to support 64bit indexing
17 ビュー (過去 30 日間)
I have a problem that mex files generated by MatLab Coder only supports 32bit indexing, which is the reason my program gets an error when the input of the bottleneck mex function exceeds an input boolean matrix which has more than 2^31 elements.
I know that mex-files support 64bit indexing when they are hand written, but since I am not comfortable with c or c++, I wonder if there is a way, and if so how, to manually correct this at the end of the coder when it shows me the code it generated?
I read that i shoukld have to replace the 'int32_T' by 'size_t' but thats not all, I would also need to replace the the constructors 'coder::array<T, 1U>' with C MEX API... and thats the point where my knowledge ends and I would need some help about what to do exactly and how to do it.
May be someone coukld help me with that.
Best regards and many thanks in advance
回答 (1 件)
Nitin Kapgate 2020 年 12 月 18 日
編集済み: Nitin Kapgate 2020 年 12 月 18 日
Currently MATLAB Coder supports only upto 2^32 elements in an array.
So you will need to manually change the codein C/C++ files.
You can refer to the guide to enable support for 64-bit indexing in MEX files using compatibleArrayDims flag in mex command.
You can use these additional instructions to upgrade MEX files to use 64-Bit API.