- Convert sparse array to a full array.
- Convert full array into a tall array.
Requested 196608x4096 (12.0GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to unresponsive
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have two matrices.
Matrix A : size is 196608x4096 sparse double
Matrix B: size is [ 16 16 16 ] double
I was trying to multiply them through a loop ( As I have other operations to execute)
Inside the loop , when these two matrices are multiplied at that moment I am getting the error :
"Requested 196608x4096 (12.0GB) array exceeds maximum array size preference. Creation of arrays greater
than this limit may take a long time and cause MATLAB to become unresponsive."
I tried with "tall" but sparse matrix cannot be converted into tall . I there any way to tackle this problem as I do not have large amount of memory in my laptop.
Thanks in Advance.
0 comentarios
Respuestas (1)
Harsh Mahalwar
el 21 de Feb. de 2024
Editada: Harsh Mahalwar
el 21 de Feb. de 2024
Hi Amit,
I can recognise that you are trying to multiply 2 matrices of size (196608,4096) and (16, 16, 16) respectively. Due to maximum array size limitations, you are unable to load the (196608, 4096) sized matrix into your MATLAB environment.
You can remove the maximum array size limit by unchecking the checkbox in MATLAB >Preferences > Workspace > MATLAB array size limit.
1. Click on Preferences (present in the Home tab)
2. Go to the workspace.
3. Uncheck the maximum array size limit checkbox.
I can see that you have also tried using the tall arrays but were unable to convert your sparse array into them directly, I have a workaround for that,
To convert a sparse array to tall array, you can,
Here’s a code example:
% Create a random sparse matrix.
rng default %for reproducibility
S = sprand(8,8,0.3)
% Convert the matrix to full storage.
A = full(S)
t = tall(A)
Still, you might not be able to load those arrays into your workspace due to low memory in your device, in that case the only option you have might be to upgrade the memory size.
Also, you can refer to a similar question on MATLAB Answer using the following link,
I hope this helps, thanks!
0 comentarios
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!