필터 지우기
필터 지우기

Read txt files from the folder one by one in for loop?

조회 수: 4 (최근 30일)
Jonasz
Jonasz 2013년 3월 14일
Hello everyone.
I need help in reading txt files from folder. I have got about 60000 files and I need to read them one by one and check some parameters . I prefer not to load the whole folder but only check one file then close it with all the information but save other variables.
Do you have an idea how to do it?

답변 (2개)

Rakesh Singh
Rakesh Singh 2013년 3월 14일
this will definitely help you
list = dir('*.txt'); % reading all the images one by one .
for i = 1:length(list)
img{i} = imread(list(i).name);
contact me for further queries rksinghrajput3@gmail.com

Honglei Chen
Honglei Chen 2013년 3월 14일
You can take a look at dir command
doc dir
For example,
d = dir(pwd)
returns a structure d, holding information of all files in the current folder. You can then pick out txt file via type and then loop through each file name.

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by