필터 지우기
필터 지우기

Read text file data

조회 수: 1 (최근 30일)
상훈 송
상훈 송 2022년 4월 29일
댓글: Rik 2022년 4월 29일
Hi. I would like to read my numerous text file which is named like 001_EQ.txt, 002_EQ.txt,......,099_EQ.txt,100_EQ.txt.
filename1 = strcat(int2str(1),'_EQ.txt');
This is a code that i tried but didn't worked well.
Thanks for your help.
Best regard.
  댓글 수: 1
Rik
Rik 2022년 4월 29일
You should also not use numbered variables. Use arrays instead.

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

답변 (1개)

Voss
Voss 2022년 4월 29일
You can generate the file names in sequence like this:
for ii = 1:100
filename = sprintf('%03d_EQ.txt',ii);
% then read file filename
end
Or generate file names all at once like this:
filenames = sprintfc('%03d_EQ.txt',1:100);
for ii = 1:100
% read file filenames{ii}
end

카테고리

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