Create .txt file and open dialog for saving-path

Hello, how can I use the function "writetable" in a way, that it opens a dialog and asks me where to save the newly generated ".txt"-file? With "iuputfile"?

 Respuesta aceptada

Jan
Jan el 29 de Jul. de 2015
You can't. This is a job for uiputfile.
[FileName, PathName, FilterIndex] = uiputfile('*.txt', 'Save table as:');
if ~ischar(FileName)
disp('User aborted the dialog');
return;
end
File = fullfile(PathName, FileName);
writetable(T, File);

1 comentario

Thank you @Jan
Someon also can use
[FileName, PathName, FilterIndex] = uiputfile('*.txt', 'Save table as:');
if ischar(FileName)
File = fullfile(PathName, FileName);
writetable(T, File);
else
disp('User aborted the dialog');
end
without using 'return'.

Iniciar sesión para comentar.

Más respuestas (1)

Felix Ludwig
Felix Ludwig el 30 de Jul. de 2015
figured it out by myself
[filename, pathname]=uiputfile('*.txt','Save');
vname=@(x) inputname(1);
i=vname(Table_1);
filename=[pathname i '.txt'];
writetable(Table_1,filename,'Delimiter','\t');

Preguntada:

el 29 de Jul. de 2015

Comentada:

el 6 de Feb. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by