Coder matrix size limitation

1 回表示 (過去 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?

サインインしてコメントする。

製品

Community Treasure Hunt

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

Start Hunting!

Translated by