Question about non-existing file

조회 수: 14 (최근 30일)
Sophie Sturkenboom
Sophie Sturkenboom 2022년 7월 15일
댓글: Sophie Sturkenboom 2022년 7월 20일
Hi,
I'm trying to run a script to load the data, but i'm getting an error. The error basically says that it reads another file in the folder, but that's weird because the file doesn't exist.
If I use the function dir() it says there is another file named '_Pelvis_Walk.csv'. Does anyone know why this is, and most importantly: how can I fix this?

채택된 답변

Stephen23
Stephen23 2022년 7월 15일
편집: Stephen23 2022년 7월 15일
" If I use the function dir() it says there is another file named '_Pelvis_Walk.csv'."
No, your screenshot clearly shows that the file is named '._Pelvis_Walk.csv'. Note the leading dot! The leading dot and underscore tell us that this file is a hidden file on Mac OSX. Most OSs include special hidden files, but just because they are not displayed using the normal Explorer app (or whatever Mac call it) does not mean that they do not exist.
"Does anyone know why this is, and most importantly: how can I fix this?"
Mac OSX uses these files to store meta-data about your file. Note that there is a lot of misinformation on the internet about these files, here is a reputable explanation:
I will copy one line from that explanation here: "The name starts with "." because many operating systems (most Unix and Linux variants) normally treat such names as invisible, even if they don't support an explicit "invisible" flag in metadata."
So DIR is correct to return it, because it is a file that exists on that drive. From that point of view, there is nothing to be "fixed". Howver you can easily remove those elements from the structure:
S = dir(..);
X = strncmp({S.name},'.',1);
S(X) = []
Also: rather than creating filepaths using concatenation you should use FULLFILE.

추가 답변 (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