Hello I'm searching for a command in my GUI(with guide) to save the data in a file which is named by user Input. I would like to have a pushbutton and it opens a window where the user just have to insert the name of the file.
See my Code:
function save_as_Callback(hObject, eventdata, handles)
result.data=getappdata(handles.data,'results_data');
result.data_new=getappdata(handles.data,'results_data_new');
save ('','result') %here user should Input Name of file but in my GUI

 Respuesta aceptada

Titus Edelhofer
Titus Edelhofer el 24 de Feb. de 2015
Editada: Titus Edelhofer el 24 de Feb. de 2015

2 votos

Hi Valentino,
use uiputfile for this task, something like
[fName, pName] = uiputfile('*.mat');
if fName==0
% user pressed cancel
return
end
save(fullfile(pName, fName), 'result');
Titus
EDIT: corrected the typo, thanks

1 comentario

Valentino
Valentino el 24 de Feb. de 2015
Editada: Valentino el 6 de Ag. de 2015
Thank you! it works fine, you just got a typing error in the first line.
[fName, pName] = uiputfile('*.mat');
if fName==0
% user pressed cancel
return
end
save(fullfile(pName, fName), 'result');

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 24 de Feb. de 2015

Editada:

el 6 de Ag. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by