How can i read 14,000 data points from a file?

i read the datapoints by using importdata... but this is not suited for large number of data points....i have to design a notch filter with this data....so i have to read 14000 data points from a file.... what i have to do??

댓글 수: 4

What format is the file?
Ruby
Ruby 2014년 2월 12일
text file
How many columns per line? What separator between columns? Are there any headers? What would a typical line look like?
Ruby
Ruby 2014년 2월 12일
sir, i have to read 14000 numbers which is in 1 column and 14000 numbers are in the 2nd column....importdata function which is in the matlab itself is not worked under this condition... there are no headers... its like in the 1st column 470 100 25 31 and so on ... and in the 2nd column 100 20 15 0 ....

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

 채택된 답변

Walter Roberson
Walter Roberson 2014년 2월 12일

0 개 추천

fid = fopen('YourFile.txt');
datacell = textscan(fid, '%f%f', 14000, 'CollectOutput', 1);
fclose(fid);
youdata = datacell{1};

댓글 수: 3

Ruby
Ruby 2014년 2월 13일
Sir,thank you...your code is working... but there is a problem... both the datas, means the two columns came together in a single variable A. So i can't do the operation in that data... actually i have to subtract A from B... So how can i assign the 1st column to one variable A... and 2nd column to B....
Ruby
Ruby 2014년 2월 13일
편집: Walter Roberson 2014년 2월 13일
sir...
fid = fopen('YourFile.txt');
datacell = textscan(fid, '%f%f', 14000, 'CollectOutput', 1);
fclose(fid);
Data = datacell{1};
A=Data(:,1)
B=Data(:,2)
C=A-B;
sir,... this code is working only if the text file consists of 14000 rows and two columns... i have a text file named sks.txt which consists of 14000 rows and 7 columns including the serial number.... 1st column is serial number... my data is in the 2nd and 3rd column.... from the text file i have to read the 2nd and 3rd column ... how can i do this??? the datas are seperated by a tab..
This is the reason I asked about the file format.
fid = fopen('YourFile.txt'); datacell = textscan(fid, '%*f%f%f%*f%*f%*f%*f', 14000); fclose(fid); A = datacell{1}; B = datacell{2}; C=A-B;

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

태그

질문:

2014년 2월 12일

댓글:

2014년 2월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by