What is the reason for this code to go out of memory?

1 visualización (últimos 30 días)
subha
subha el 2 de Sept. de 2014
Respondida: Image Analyst el 10 de Sept. de 2014
filename= 'train_images_idx3_ubyte';
imgs=[];
readdigit =60000
% Read digits % This program reads 60000 binary image
fid = fopen(filename, 'r','b');
offset= fread(fid, 4, 'int32');
imgs = fread(fid,inf, 'uchar');
imgs = transpose(reshape(imgs,28*28,readdigits));
fclose(fid);
In this code,if i didnt use transpose in line 7, it shows out of memory. I have 1.8 terabyte of memory. Then y it shows out of memory. If i use transpose, it goes good. Whats the reason?

Respuestas (1)

Image Analyst
Image Analyst el 10 de Sept. de 2014
You're trying to reshape whatever you read in into a 784 (=28*28) row by 60 thousand column matrix. Why, when you only have 60 thousand numbers?
When you first get imgs, what does this say
whos imgs
Type memory on the command line and paste what you see back here.
>> memory

Categorías

Más información sobre Large Files and Big Data en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by