load matlab file to current workspace
Show older comments
Hi,
I use this code to load .m file
[filename, pathname] = uigetfile( ...
{'*.m', 'All matlab-Files (*.m)'; ...
'*.*','All Files (*.*)'}, ...
'Select Matlab File');
save(fullfile(pwd, filename));
but! .. when i open it after loading, its content was changed to undefined character like this:
ه3"av خًOتJM.aà„ت?A?GB‰?JKـ2sR?sS‹!b?HْYذô3Bظ0s? ü¬ؤ”ش ¨™??ô³ èga?ِwٍ?és ڈ?ح^?ك%5/?³83/]/?,?
how i can save it with orginal content (matlab code)?
4 Comments
Honglei Chen
on 15 Dec 2011
Could you clarify exactly what you want to do? save command saves the workspace variables, not the file. Besides, you already have the file and what's the point to save it again? Do you mean you want to run the script and save the result?
Amani
on 16 Dec 2011
Fangjun Jiang
on 16 Dec 2011
To "add it to current directory too", use copyfile()
Amani
on 19 Dec 2011
Accepted Answer
More Answers (0)
Categories
Find more on App Building in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!