Read Sequence text files in Matlab
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hussein Mohasseb
am 17 Jan. 2016
Kommentiert: harjeet singh
am 17 Jan. 2016
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 ?
0 Kommentare
Akzeptierte Antwort
harjeet singh
am 17 Jan. 2016
Bearbeitet: Walter Roberson
am 17 Jan. 2016
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 Kommentare
Walter Roberson
am 17 Jan. 2016
Please learn to use fullfile() as we do not assume that everyone is using MS Windows (OS-X and Linux use / not \ )
harjeet singh
am 17 Jan. 2016
thanks @walter so the above command will be like
file_path=fullfile(folder_name,file_name);
Weitere Antworten (1)
Hussein Mohasseb
am 17 Jan. 2016
1 Kommentar
harjeet singh
am 17 Jan. 2016
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
Siehe auch
Kategorien
Mehr zu String finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!