필터 지우기
필터 지우기

Coder matrix size limitation

조회 수: 4 (최근 30일)
Rudi Schuech
Rudi Schuech 2017년 3월 1일
댓글: Rudi Schuech 2020년 5월 8일
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
Rudi Schuech
Rudi Schuech 2020년 5월 4일
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?

댓글을 달려면 로그인하십시오.

답변 (1개)

Arnav Mendiratta
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.
  댓글 수: 1
Rudi Schuech
Rudi Schuech 2020년 5월 8일
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?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Deployment, Integration, and Supported Hardware에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by