It's been a few years and the limitation is still there in 2020a, so just wondering - any plans to eventually lift this limitation? Why does it exist?
Coder matrix size limitation
조회 수: 1 (최근 30일)
이전 댓글 표시
There is a hard limit on max matrix size in MATLAB Coder, even on 64 bit platforms with enough RAM:
https://uk.mathworks.com/help/fixedpoint/ug/array-size-restrictions-for-code-generation.html
I've run into this and have had to use a workaround which involves splitting my matrix into separate variables, using them in the mex function, and combining back into a single matrix later outside of my mex function, but this workaround requires even more memory and the limitation is thus rather annoying. Just wondering if there is any plan to lift this restriction in future versions.
Rudi
답변 (1개)
Arnav Mendiratta
2017년 3월 3일
As of today, this restriction still exist.
There are some workarounds that you can consider:
1. Generate a static or dynamic library from the MATLAB function, call the entry point function test_build() with coder.ceval() in a MATLAB Function block, and link the Simulink model with the library in the Custom Code pane of Configuration Parameters. Please note that this does require a bit of effort, however, because the function's input "datain" will need to be specified as an emxArray. The library provides an emxAPI to help users construct this data type out of the C native types, but doing so requires extra hand code.
2. Try to rewrite the code in such a way that the worst case static array size does not exceed the maximum limit. This suggestion is similar to one you have been using by breaking down your array into multiple arrays.
3. Call the MEX file generated from MATLAB Coder in an Interpreted MATLAB Function block (or a regular MATLAB Function block with coder.extrinsic() ). However, this will not work if your end goal is to generate code from the model.
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!