필터 지우기
필터 지우기

how to import large data file into matlab

조회 수: 11 (최근 30일)
Abebe kebede
Abebe kebede 2015년 7월 16일
댓글: Abebe kebede 2015년 7월 17일
I have very large data 5GB space delimited mixed data (data.prn) with column header:
*0000*
*0000*
al 10.598010201 1.890025647
am 11.222025789 -5.369021654
as -10.256862254 11.235854322
at 14.589056356 15.888792312
. .
. .
I know it has three column but i don't know exactly the number of rows since the data is to large to open. My target is to plot data(:,1) vs data(:,2). Any suggestion which command is fast to import the data to matlab.Thanks!

채택된 답변

Walter Roberson
Walter Roberson 2015년 7월 16일
fid = fopen('data.prn', 'rt');
datacell = textscan(fid, '%*s%f%f', 'HeaderLines', 2);
fclose(fid);
plot(datacell{1}, datacell{2})
However, keep in mind that your screen only has a few thousand pixels, not billions, so you are going to end up with multiple data points per pixel, which will be slow and of no good visual purpose. You should consider plotting only a subset of the data, such as
plot(datacell{1}(1:1000:end}, datacell{2}(1:1000:end))
  댓글 수: 2
Abebe kebede
Abebe kebede 2015년 7월 16일
Thanks Walter.
Abebe kebede
Abebe kebede 2015년 7월 17일
@Walter, It seems the output is no as i want it. When i used the above code and try to read datacell{:}i get
10.598010201
NaN
10.598010201 ... and so on
but i want the result to be like
[10.598010201] [1.890025647]
[11.222025789] [-5.369021654]
[-10.256862254] [11.235854322]
and so on. Thanks

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by