delete element from txt file

조회 수: 12 (최근 30일)
huda nawaf
huda nawaf 2011년 11월 6일
hi, is there a way to delete element from txt file . I have files ,I want delete the first two elements in each file.
the structure of my file(1) as:
1:
text.....
file(2)
2:
text.....
etc.
I want to delete 1:, 2:, 3: etc...
thanks

답변 (1개)

Walter Roberson
Walter Roberson 2011년 11월 6일
It is greatly recommended that if you need to delete something from a text file, that you copy the parts that you want to keep to a new file, possibly renaming files afterwards. Deleting text from an existing file is messy.
  댓글 수: 5
huda nawaf
huda nawaf 2011년 11월 7일
4:
1666394,3,2005-04-19
1759415,4,2005-04-22
1959936,5,2005-11-21
998862,4,2004-11-13
2625420,2,2004-12-06.
I don't want 4:
I used
c = textscan(f,'%f %f %s','headerLines',1);
I got:
c =
[1666394] [] {}
how I can textscan to return c{1} as:
1666394
1759415
1959936
998862
2625420
thanks
Walter Roberson
Walter Roberson 2011년 11월 7일
c = textscan(f,'%f %f %s','Delimiter',',','headerLines',1);

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

카테고리

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