array slicing in place
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi
I'm trying to slice a really big array, but I'm getting out of memory.
is it possible to do slicing "in-place" (similar to python), where it will use the same memory?
e.g:
size(mat) ==> 32 X 32 X 750 X 2 X 1000
mat = mat(1:31,1:31,:,:,:) ;
the last operation allocates a new array, and only after it finishes copying it releases the old one (and keep naming the same).
It does not slice it in place, hence requires (almost) twice the memory.
any ideas?
Thanks
0 Commenti
Risposte (1)
Ameer Hamza
il 1 Apr 2020
I guess you are looking for something like this: https://www.mathworks.com/matlabcentral/fileexchange/24576-inplacearray-a-semi-pointer-package-for-matlab
Also check the discussion on this question: https://www.mathworks.com/matlabcentral/answers/370282-is-it-possible-to-create-a-sub-array-without-using-additional-memory-on-matlab
As an alternative, you might also look into matfile() if the file is already saved in a mat file.
0 Commenti
Vedere anche
Categorie
Scopri di più su Matrices and Arrays in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!