mex command with -largeArrayDims and/or -R2017b?

10 ビュー (過去 30 日間)
Jan
Jan 2019 年 2 月 3 日
回答済み: Jan 2019 年 2 月 9 日
[New Formulation after only 5 views and no answer after 3 days]
I want to compile a C file under different Matlab versions preferrably with the same command. I know these directives for the mex command:
  • -compatibleArrayDims (32-bit C-Matrix-API)
  • -DMX_COMPAT_32 (32-bit C-Matrix-API)
  • -largeArrayDims (64-bit C-Matrix-API)
  • -2017b (separate complex data, C-Matrix-API: mxGetPr)
  • -2018a (interleaved complex numbers, C-Data-API: mxGetData)
The first 2 are equivalent and the default under <= R2015b/32, as far as I know. My codes are 64 bit clean and use the C-Matrix-API e.g. the mxGetPr() command, so the 32 bit flags are needed only to support olöd 32 bit systems.
I want to compile with largeArrayDims (64 bit arrays) and the C-Matrix-API:
mex -O -largeArrayDims -R2017b test.c
But under R2018b this fails with the message:
*** Compilation failed:
Calling MEX with both 'R2017b' and 'largeArrayDims' not supported.
Why? I thought, that these directives are not mutually exclusive, but equivalent.
Do I need different flags for calling mex under R2016b and R2018b?
Some corresponding pages, which does not clarify the question:

採用された回答

Jan
Jan 2019 年 2 月 9 日
According to the answer of the technical support:
The 64 bit addressing triggered by the -largeArrayDims flag is implicitly enabled by -R2017b already. Although there is no conflict for the actual compilation, the flags are treated as incompatible.
Solution: Use -largeArrayDims for compiling under older Matlab versions, and -R2017b for newer ones:
if verLessThan('matlab', '9.4') % < R2018a
mex -largeArrayDims test.c
else % >= 2018a
mex -R2017b test.c
end
Not handy, but working.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWrite C Functions Callable from MATLAB (MEX Files) についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by