Array limit for matlab coder
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Martin Andersson
le 16 Avr 2023
Modifié(e) : Martin Andersson
le 16 Avr 2023
Hi,
I'm using matlab coder to speed up time. However, I have an array which in normal matlab becomes ArrayLarge: 31x1x441, 109368 double.
But when I use coder and compile a mex file, my Matlab craches. With the Mex file I have generated I can genrate the same array but only up to aboute ArrayLarge: 31x1x246, 61008 double, before it crashes.
But how can I compile an mex file which can create the ArrayLarge: 31x1x441, 109368 double, which is generated with the regular matlab code. Is it some settings in the MatLab coder which I can change? (It is not memory problem for the comuter as the coputer enables to create the ArrayLarge on original MatLab 2022a).
0 commentaires
Réponse acceptée
Walter Roberson
le 16 Avr 2023
I suspect that you are reaching the stack size limit.
If you are generating for real-time work, then you would need to increase the stack size limit.
If you are not generating for real-time work, then enable dynamic memory allocation for the array; https://www.mathworks.com/help/coder/ug/minimize-dynamic-memory-allocation.html
3 commentaires
Walter Roberson
le 16 Avr 2023
ArrayLarge = zeros(31, 1, 441);
numel(ArrayLarge)
whos ArrayLarge
So the 109368 is already bytes, not number of elements.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur MATLAB Coder dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!