Matlab loads part of huge file
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
Good day to all.
I'm loading a huge file of data. First row contains station name. First column contains dates. The data are of type double. The csv file i'm loading haw a total of 35065 rows and 5000 columns. I use the following code:
TestData=importdata (filename,';');
vars = fieldnames(TestData);
for i = 1:length(vars)
assignin('base', vars{i}, TestData.(vars{i}));
end
Matlab loads only 17504 rows and ignores the rest. Im working on a relatively powerfull linux machine, with an i7 processor and 24G memory.
Does anyone know the nature of the problem here. Is it matlab limitaion? Can i do something to fix it?
Thank you all!
1 件のコメント
Stephen23
2014 年 9 月 19 日
Do not create or use variable names dynamically like this. Use a cell array or structure instead:
回答 (2 件)
per isakson
2014 年 9 月 19 日
編集済み: per isakson
2014 年 9 月 19 日
My guess is that row number 17504 of your file contains something that causes importdata to stop reading.
A little experiment
>> importdata( 'cssm.txt' )
ans =
data: [4x5 double]
textdata: {'A' 'B' 'C' 'D' 'E'}
colheaders: {'A' 'B' 'C' 'D' 'E'}
>> ans.data
ans =
17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 NaN NaN NaN
>>
where cssm.txt contains
A B C D E
17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 BBB 21 3
11 18 25 2 9
"BBB" in the 4th data-row causes importdata to
- stop reading
- pad that row with NaN and
- skip the remaning rows
What is worse is that importdata does this without warning the user.
0 件のコメント
thankar
2014 年 9 月 22 日
0 投票
1 件のコメント
per isakson
2014 年 9 月 22 日
I assume you have 64bit system.
>> 35065 * 5000 * 8 /1e9
ans =
1.4026
That's 1.4GB and another <3GB for the file itself.
Sounds a bit strange. I would like to make a test. Could you you upload the file somewhere?
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!