matlab disk space and memory issues

19 次查看(过去 30 天)
I am running a script that is formatting some data for use in a machine learning/classification system. However when running it MATLAB ends up using 100% of disk space and up to 80% of memory.
Even when I temporarily pause the script matlab is still using a good 50-60% of memory. This is even after waiting for several minutes after pausing the script.
Any way I can stop matlab needlessly using so much memory and hard disk space? Seems to me that it should not be doing this when an application is paused, though perhaps I am mistaken since my script initializes a 8192x140,000 matrix of zeroes and then replaces each column with new data.
Many thanks
Regards R
  5 个评论
cnfan_sd70
cnfan_sd70 2018-6-21
Hi Steven, here I am posting a little bit of my code to show you what may be causing the memory problem (I cannot post all the code however)
function [dataVEC,labelsVEC] = NAME(DATA)
dataVEC = zeros(8192,length(DATA));
labelsVEC = zeros(length(DATA),1);
for j = 1:length(DATA)
a_1 = DATA{j,1}.a;%assign to required section of data vector
a_1 = a_1 - mean(a_1);
a_1 = a_1/norm(a_1);
a_1 = [a_1(1,1:400) circshift(a_1(1,401:end),floor(randn*150))];
data = feature_extract(a_1);
dataVEC(:,j) = data;
labelsVEC(j,1) = DATA{j,1}.label;
end
end
I have "hidden" some of code in a fake function called "feature_extract" so as to show you the basic creation of arrays etc in my code without giving too much away.
Some matlab functions I have used within my feature extraction are "isnan", "interp1", "findpeaks", "hilbert".
Hope this is enough info for you to take a guess as to whats going wrong! Cheers.
cnfan_sd70
cnfan_sd70 2018-6-21
Sorry I forgot to say - as you can see, before the for loop, the data matrix is initialised as an 8192x140,000 matrix of zeros. The labels matrix is initialised as an 140,000x1 vector of zeros. Each column of the data matrix is then assigned a piece of formatted data that is 8192x1 in size. Then it loops round and does the same basic operation again

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

产品


版本

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by