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"?

 Réponse acceptée

Jan
Jan le 29 Juil 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 commentaire

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'.

Connectez-vous pour commenter.

Plus de réponses (1)

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');

Community Treasure Hunt

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

Start Hunting!

Translated by