필터 지우기
필터 지우기

reading only certain columns in text file

조회 수: 3 (최근 30일)
Chace
Chace 2014년 10월 28일
답변: per isakson 2014년 10월 28일
Hi! I am loading in a pretty large text file, and I want to omit column 1 from reading my data. I'm not excellent at matlab, so I was wondering if anyone had any input? Here is the first few points of the data:
1.00000 0.00635 0.00787 0.43964 -0.08261 0.00528 -0.00278
1.00000 0.00803 0.00775 0.43942 -0.08252 0.00421 -0.00421
1.00000 0.00851 0.00894 0.43985 -0.08276 0.00385 -0.00183
1.00000 0.00827 0.00742 0.43930 -0.08380 0.00308 -0.00238
1.00000 0.00888 0.00641 0.43933 -0.08395 0.00333 -0.00296
1.00000 0.00879 0.00674 0.43997 -0.08438 0.00262 -0.00333
1.00000 0.01123 0.00507 0.44019 -0.08530 0.00098 -0.00317
1.00000 0.01279 0.00406 0.44040 -0.08594 0.00070 -0.00253
(also the preview version is messing with how the data is supposed to show - sorry!) I do not want to include the first column in my data, only columns 2-7. Any suggestions on how to do this? Thanks!

답변 (1개)

per isakson
per isakson 2014년 10월 28일
Try:
fid = fonpen( filespec );
cac = textscan( fid, '%*f%f%f%f%f%f%f', 'CollectOutput', true ) ;
sts = fclose;
and see help on &nbsp textscan

카테고리

Help CenterFile Exchange에서 Data Import and Export에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by