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

조회 수: 1 (최근 30일)
subha
subha 2014년 9월 2일
답변: Image Analyst 2014년 9월 10일
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?

답변 (1개)

Image Analyst
Image Analyst 2014년 9월 10일
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

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by