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

1 visualizzazione (ultimi 30 giorni)
KJ
KJ il 17 Lug 2015
Risposto: Walter Roberson il 17 Lug 2015
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!

Risposte (1)

Walter Roberson
Walter Roberson il 17 Lug 2015
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.

Categorie

Scopri di più su File Operations in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by