필터 지우기
필터 지우기

What is the order when calling a directory?

조회 수: 1 (최근 30일)
Zeynab Mousavikhamene
Zeynab Mousavikhamene 2019년 10월 14일
편집: Walter Roberson 2019년 10월 14일
I call a directory which is a folder cotaining several files and then I use for loop to do specific calculatuions on each file in that folder.
I wanted to know in what order does matlab parse each of those files (by alphabette?size?)? and can user detremine the order?
  댓글 수: 1
Rik
Rik 2019년 10월 14일
You mean the output order for dir? For uigetdir?

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

채택된 답변

Walter Roberson
Walter Roberson 2019년 10월 14일
편집: Walter Roberson 2019년 10월 14일
MATLAB uses whatever order is returned by the operating system.
It happens that in MS Windows, and MacOS, and Linux, that the operating system does not impose an order. Instead, the operating system leaves it up to the file system driver, so the order for NTFS could be different than the order for FAT16 for example.
I have not found any documentation on the order used by NTFS. In practice it appears to sort either by byte code representation of the name or else by unicode code point. Apple's HFS+ has an ordering based upon "fully decomposed canonical representation" in theory but in practice the ordering apparently has some bugs. Most of the Linux file systems do not define an order, and I recently encountered a claim that one of the Linux file systems sorts according to a hash of a file name.
The user has no control over the order in any of the operating systems.
You might want to look in the File Exchange for "natural filename sort".

추가 답변 (0개)

카테고리

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