How do I access a certain directory?
조회 수: 42 (최근 30일)
이전 댓글 표시
How do I access a certain directory, so i can then retrieve certain images from that specified directory?
댓글 수: 0
답변 (2개)
Jan
2019년 9월 9일
You can define the path of a file to access it:
Folder = 'C:\Temp\';
FileList = dir(fullfile(Folder, '*.jpg'));
for iFile = 1:numel(FileList)
File = fullfile(FileList(iFile).folder, FileList(iFile).name);
% Do what you want with this file, e.g.:
Img = imread(File)
end
madhan ravi
2019년 9월 9일
help cd
댓글 수: 3
Jan
2019년 9월 9일
It is unsafe to change to a specific directory only to access the included files. Using absolute path names is better, because this is not confused by GUI or TIMER callbacks, which call cd again unexpectedly.
참고 항목
카테고리
Help Center 및 File Exchange에서 File Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!