필터 지우기
필터 지우기

'Movefile' made a new directory but it can't be opened

조회 수: 1 (최근 30일)
KJ
KJ 2015년 7월 17일
답변: Walter Roberson 2015년 7월 17일
Situation: I was using movefile() to move data files to another directory. The data files were .mat format. The destination directory did not exist so MATLAB automatically created the destination folder (let's call this new directory problem_directory).
Problem: The folder problem_directory that was created is not recognized as a folder by Windows - the file type is 'File' in Windows Explorer and I can't open it to get to the data file inside.
What I tried so far: I tried to 'Open with' Notepad and MATLAB, but neither worked. In both cases, the file presented on the first line
MATLAB 5.0 MAT-file, Platform: PCWIN64, Created on: Fri Dec 19 09:41:35 2014
followed by screeds of garbage characters (I imagine due to incorrect decoding).
When I use
folders = dir('source\')
where source is the source folder of problem_directory, the field isdir for problem_directory has value 0 (I suppose this confirms that MATLAB does not recognize it as a folder).
Request: How can I force this directory to be recognized as a folder, so that I can open it and access the file inside which I copied over?
Thank you!

답변 (1개)

Walter Roberson
Walter Roberson 2015년 7월 17일
Whatever method you used to create the output name has ended up using the folder name as being the file name. You movefile()'d a bunch of different files into the same file name. The result is whichever .mat file you movefile()'d last, but possibly without its .mat extension. The other files are gone and cannot be recovered except perhaps by some kind of undelete utility. Time to recover them from your backup.

카테고리

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