Hi All,
I have a dataset which contains 316663 cells, each cell contains either a 600-by-1 or a 300-by-1 matrix. I got the error when I execute the following code
X_fft = cellfun(@fft,Data,'UniformOutput',false);
Any idea how can I solve this issue?
Thaks in advance!

 Respuesta aceptada

Joel Lynch
Joel Lynch el 9 de Jun. de 2021
Out of memory is exactly what it sounds like: your program is trying to hold more data on system memory than is available. The cell array alone around (316663*400*8/1e9=1) GB of memory, plus overhead, not to mention the memory required during FFT calculation. You can run
whos
at a breakpoint before this line to see exactly how much memory it takes up. You can also make sure other programs (especially web browsers) are not hoarding memory using your computer's system monitoring tools.
If that doesn't free-up enough memory, you need to reduce how much is being used by MATLAB at any one time. Most likely, you do not need to store all cell arrays on memory at once. So you can break up the problem into chuncks, running FFT on a section of data at a time.

4 comentarios

Susan
Susan el 9 de Jun. de 2021
Thanks for your reply! Breaking up the problem in chuncks solved the issue
John D'Errico
John D'Errico el 9 de Jun. de 2021
Assuming your computation of the RAM required for the inputs is correct, the result from the FFTs will take another 2 GB of memory, because the FFT generates complex results. Each element of a complex array requires 16 bytes of RAM to store it, even though a double only requires 8 bytes.
Susan
Susan el 9 de Jun. de 2021
@John D'Errico Thanks for the note. Good to know that!
Susan
Susan el 9 de Jun. de 2021
@Joel Lynch@John D'Errico For breaking up the problem into chuncks, I take fft using 3 for loops to get the results. Is there a way that I can do that without using the for loop?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Preguntada:

el 9 de Jun. de 2021

Comentada:

el 9 de Jun. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by