필터 지우기
필터 지우기

Read Sequence text files in Matlab

조회 수: 1 (최근 30일)
Hussein Mohasseb
Hussein Mohasseb 2016년 1월 17일
댓글: harjeet singh 2016년 1월 17일
Hello everybody , I want to read more than one text file in Matlab with loop , this files not in sequence names same this 'GSM-2_2002095-2002120_0021_UTCSR_0060_0005' 'GSM-2_2002123-2002137_0012_UTCSR_0060_0005', How can i do it ?

채택된 답변

harjeet singh
harjeet singh 2016년 1월 17일
편집: Walter Roberson 2016년 1월 17일
try to use this code, do read file with fopen using file_path in the loop
folder_name='ABC';
files=dir(folder_name);
for i=3:length(files)
file_name=files(i).name;
file_path=strcat(folder_name,'\',file_name);
end
  댓글 수: 2
Walter Roberson
Walter Roberson 2016년 1월 17일
Please learn to use fullfile() as we do not assume that everyone is using MS Windows (OS-X and Linux use / not \ )
harjeet singh
harjeet singh 2016년 1월 17일
thanks @walter so the above command will be like
file_path=fullfile(folder_name,file_name);

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

추가 답변 (1개)

Hussein Mohasseb
Hussein Mohasseb 2016년 1월 17일
thanks harjeet singh very much about ur answer but please i want u write example
  댓글 수: 1
harjeet singh
harjeet singh 2016년 1월 17일
folder_name='test';
files=dir(folder_name);
for i=3:length(files)
file_name=files(i).name;
file_path=fullfile(folder_name,file_name);
fid=fopen(file_path);
c=fread(fid,inf,'*char')
end

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

카테고리

Help CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by