Out of memory issue

2 ビュー (過去 30 日間)
Arun Badigannavar
Arun Badigannavar 2014 年 6 月 12 日
編集済み: C.J. Harris 2014 年 6 月 13 日
I am getting error,while Loading abc.csv file of 16567kb size,as Out of memory, I have Intel core2duo,3 ghz,3GB RAM,,please help me,, I want to convert .csv file to .mat file by loading it in workspace
  5 件のコメント
Arun Badigannavar
Arun Badigannavar 2014 年 6 月 13 日
Windows7,2010a ReleaseMATLAB,other programs running,csvread,xlsread,,nothing is working
Arun Badigannavar
Arun Badigannavar 2014 年 6 月 13 日
??? Error: Not enough storage is available to complete this operation.
Error in ==> xlsread at 316 rawData = DataRange.Value

サインインしてコメントする。

回答 (1 件)

C.J. Harris
C.J. Harris 2014 年 6 月 13 日
編集済み: C.J. Harris 2014 年 6 月 13 日
For large CSV files you are less likely to run into memory issues if you read it line by line, for example:
nFile = 'file.csv';
[fid, message] = fopen(nFile,'r');
i=1;
numlines = str2double(perl('Countlines.pl', nFile));
while 1
tline = fgetl(fid);
if ~ischar(tline), break, end
comma = findstr(tline,',');
if i == 1
numComma = length(comma);
body_data = cell(numlines, numComma+1); % pre-allocate
end
body_data{i,1} = tline(1:comma(1)-1);
body_data{i,numComma+1} = tline(comma(end)+1:end);
for nData = 1:numComma-1
body_data{i,nData+1} = tline(comma(nData)+1:comma(nData+1)-1);
end
i = i + 1;
end
fclose(fid);
Where the perl script simply contains:
while(<>){};
print $.,"\n",

カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by