load matlab file to current workspace
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Naz
il 16 Dic 2011
uigetfile gets the path, not the data. Before saving you need to load your file. Thus, use function load and give it the path obtained from uigetfile. After you load the data into the variable, you can save it using save function. Also, since you have the filename and the pathname, you dont need to use fullfile. The full path can be provided as follows:[ pathname filename ] As far as I understand you are trying to create a bank of addresses and display them in the listbox, as well as save the data to file. For updating your listbox use the fillowing idea:
your code here
....
currentDATA=get(listbox.handles,string);
updatedDATA={currentDATA; pathfile filename};
set(handles.listbox,string,num2str(updatedDATA)); %updates the listbox
save([pathname filename],'updatedDATA'); saves the data to file
4 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Migrate GUIDE Apps 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!