필터 지우기
필터 지우기

How can i read second column from a txt file in matlab

조회 수: 10 (최근 30일)
arooba mazhar
arooba mazhar 2017년 3월 12일
편집: Walter Roberson 2017년 3월 12일

채택된 답변

Abdurrehman
Abdurrehman 2017년 3월 12일
편집: Abdurrehman 2017년 3월 12일
[Filename,FilePath]=uigetfile('\\Address\*.txt','Load File');
FileName=fullfile(FilePath,Filename);
NoofCol=7;% Total no of col. in ur file
Format=repmat('%s',1,NoofCol);
fid=fopen(FileName,'rt');
Header=fgetl(fid);% to delete first line (You can use this line as title for data plotting)
data_cell=textscan(fid,Format,'HeaderLines',1,'CollectOutput',1);
fclose(fid);
data=data_cell{1};
SecCol=str2double(data(:,2));
Hope the above will help you
  댓글 수: 3
arooba mazhar
arooba mazhar 2017년 3월 12일
Thanks alot it worked :)
Abdurrehman
Abdurrehman 2017년 3월 12일
It was my very first answer :-)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by