Matlab Corrupted Files by movefile
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
So this morning I was sorting a few files on my computer, and came across a Matlab script. I decided to open the script in Matlab to see if I needed it or not, and because it was not located in the usual Matlab folder path, Matlab opened in the "Current Folder' which had various files such as Microsoft Word, Powerpoint, etc. Well awhile ago I created a finish.m script to help clear the files in the Matlab folder path that usually opens by moving any files in the 'Current Folder' path into a folder on the Matlab path titled 'Current'. This script is:
function finish %% Store current files in folder 'Current'
directory = dir;
directory_size = size(directory);
directory_names = directory_size(1);
for i = 1 : directory_names
if (isdir(directory(i).name) == 0)&& ...
(strcmp(directory(i).name, 'diary') ~= 1)&& ...
(strcmp(directory(i).name, 'finish.m') ~= 1)&& ...
(strcmp(directory(i).name, 'matlab.mat') ~= 1)&& ...
(strcmp(directory(i).name, 'startup.m') ~= 1)
movefile(directory(i).name, 'Current') ;
end
end
%% Save and then clear Workspace
save ;
clear all ;
end
So not realizing it, after closing Matlab while still in the 'Current folder' path, the finish script detected the 20 or 30 Microsoft etc. files and attempted to move them into the folder 'Current'. What happened is all the files seem to be condensed into a file called 'Current' that, when opened in the Matlab script editor, shows strings of random symbols. I was so upset when I realized what happened, and I assume the file is corrupt. Is there any way to recover these files? I was reading about doing a system restore (I have a Windows computer), but I don't know if that would resolve it. I appreciate all the help.
0 commentaires
Réponses (1)
Image Analyst
le 18 Oct 2014
I don't doubt that "various files such as Microsoft Word, Powerpoint " would look like gibberish "when opened in the Matlab script editor" . They're binary files, not text files, so what did you expect? The key thing is if you can still open them in the application they were intended for, like Word or Powerpoint. Can you do that?
Voir également
Catégories
En savoir plus sur File Operations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!