Sort the dir loaded files
조회 수: 3 (최근 30일)
이전 댓글 표시
I am using
imagefiles = dir(fullfile(d, '*.jpg'));
to get the jpg images in a folder that are named numerically like 1.jpg, 2.jpg, ...
I noticed that they are not loaded with their order like 1.jpg, 2.jpg, 3.jpg, ... and they are just randomly loaded like 1.jpg, 10.jpg, 2.jpg, ...
How can I load them with an order
댓글 수: 0
채택된 답변
Walter Roberson
2019년 11월 2일
Construct the file names instead of reading them.
Or construct better file names when you write them -- use leading 0's in the name.
Or look in the File Exchange for "Natural Directory Sort"
댓글 수: 0
추가 답변 (1개)
Stephen23
2019년 11월 2일
Download my FEX submission natsortfiles and follow the examples in its documentation:
댓글 수: 0
참고 항목
카테고리
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!