i have to read files in specific folder

조회 수: 7 (최근 30일)
OriAlpha
OriAlpha 2019년 2월 14일
댓글: Bob Thompson 2019년 2월 15일
first thing i have to select files a folder
then i have to read jpg
in that folder
how can i do that
i tried with below code
but i cant get the count
test_image = uigetdir('F:\R Project\');
mat = dir ('*.jpg')

답변 (1개)

Bob Thompson
Bob Thompson 2019년 2월 14일
You need to specify the path that you gathered with 'test_image', otherwise the dir command is just going to search the current directory.
test_image = uigetdir('F:\R Project\');
mat = dir([test_image,'\*.jpg']);
  댓글 수: 5
OriAlpha
OriAlpha 2019년 2월 15일
편집: OriAlpha 2019년 2월 15일
Cannot open file "." for reading. You might not have read permission.
Error in imread (line 340)
fullname = get_full_filename(filename);
Error in sample (line 11)
im = imread(test_image1);
Bob Thompson
Bob Thompson 2019년 2월 15일
It seems that the mat file isn't gathering the correct file name, so it is unable to load. I would suggest doing some more robust debugging of your own. Check things like making sure you don't have double slashes in your directory name, or aren't missing a slash. Try copying the name directly from file explorer and loading it directly, rather than having matlab generate the name reactively.

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

카테고리

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