What is the reason for this code to go out of memory?
2 views (last 30 days)
Show older comments
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?
0 Comments
Answers (1)
Image Analyst
on 10 Sep 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
0 Comments
See Also
Categories
Find more on Software Development Tools in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!