필터 지우기
필터 지우기

I need some Help with data formatting in file .txt

조회 수: 2 (최근 30일)
Bruno Souza
Bruno Souza 2018년 2월 14일
댓글: Roy Kadesh 2018년 2월 16일
I have a file with 22 columns and 745 lines. The first line is just a header. I need to delete the first column. How can I do that? The header can be delete too.
the data follow the format below.
Thanks
Hora No1 No2 No3 No4 No5 No6 No7 .... No21
00:00:00 18.54 18.69 18.83 18.95 19.05 19.15 19.73
00:00:10 .. ... ... ... ... ... ...
...
...

채택된 답변

Roy Kadesh
Roy Kadesh 2018년 2월 14일
If you have read your file to a table, you can just remove the variable. If you read your file as a char matrix, you can just remove the first 9 element (with A(:,1:9='';) and remove the top row (with A(1,:)='';).
  댓글 수: 2
Bruno Souza
Bruno Souza 2018년 2월 15일
Dear Roy, I don't know how to read the file like a table or matrix...
Roy Kadesh
Roy Kadesh 2018년 2월 16일
Did you find a solution? If not, the code below should help:
fid=fopen(filename,'rt');
data=textscan(fid,'%s','Delimiter','\n');
fclose(fid);

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by