Get specific data from text file

조회 수: 4 (최근 30일)
FeiMing
FeiMing 2013년 4월 3일
I have a text file containing collected raw data. I am only interested in the three columns . How can I get only these three columns in a matrix. I tried
data= importdata('testfile.txt');
as a result I have the requested matrix data, textdata and colheaders. My question is how can I get only the data and omit the txtdata and colheaders.
There are five rows before starting collecting data.Like this, for example :
Interval= 0.001 s
ExcelDateTime= 4.1286505976192129e+004 2013-1-12 12:08:36.343
TimeFormat= StartOfBlock
ChannelTitle= XXXXX XXXXX
Range= 5.000 mV 5.000 mV
after that there are there three columns(numbers) that I want to extract them. So I do not want the upper mentioned five lines to be included.
  댓글 수: 1
per isakson
per isakson 2013년 4월 3일
편집: per isakson 2013년 4월 3일
see textscan, ... '%*f' skips a column

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

답변 (1개)

Walter Roberson
Walter Roberson 2013년 4월 4일
Use textscan() with HeaderLines set to 5 and format set to '%f%f%f'
  댓글 수: 1
FeiMing
FeiMing 2013년 4월 4일
편집: FeiMing 2013년 4월 4일
fid= fopen('TestFile.txt');
C= textscan(fid,'%f%f%f', 'HeaderLines',5);
it gives C<1x3 cell> every element contains 40256x1 double
but no data/numbers, 40256 reflects the number of sampled data in every column.

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

카테고리

Help CenterFile Exchange에서 Text Data Preparation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by