Coder matrix size limitation

2 vues (au cours des 30 derniers jours)
Rudi Schuech
Rudi Schuech le 1 Mar 2017
Commenté : Rudi Schuech le 8 Mai 2020
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 commentaire
Rudi Schuech
Rudi Schuech le 4 Mai 2020
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?

Connectez-vous pour commenter.

Réponses (1)

Arnav Mendiratta
Arnav Mendiratta le 3 Mar 2017
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 commentaire
Rudi Schuech
Rudi Schuech le 8 Mai 2020
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?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Deployment, Integration, and Supported Hardware dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by