필터 지우기
필터 지우기

textscan,skip 4 first line and import olny 2 columm....

조회 수: 5 (최근 30일)
Andrew
Andrew 2013년 6월 20일
=============================================================================== ANSOFT CORPORATION 05/01/13 XY Plot 1 20:34:28
------------------------------------------------------------------------------- Freq [GHz] dB(St(pinin_T1,pinin_T1)) []
2.000000000000000 -2.389177046115443
2.020000000000000 -1.373221057933849
2.040000000000000 -0.898399723681567
2.060000000000000 -0.661901265367355
how can i skip the 4 first lines(headerlines = 4;) and then import only the second columm to a matrix? then the matrix A will have only one columm and i want this one columm matrix to become one row matrix.... for example B=(-2.39 -1.37 -0.89 -0.66)
thank you...

채택된 답변

Thorsten
Thorsten 2013년 6월 20일
편집: Thorsten 2013년 6월 20일
fid = fopen('sample.txt');
Input all:
D = cell2mat(textscan(fid, '%f%f', 'headerlines', 4));
Select just the second column and transpose to turn into row:
B = D(:,2)';

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Denoising and Compression에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by