What is the reason for this code to go out of memory?
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Software Development Tools 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!