'Movefile' made a new directory but it can't be opened
1 次查看(过去 30 天)
显示 更早的评论
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!
0 个评论
回答(1 个)
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.
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!