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

 採用された回答

Jan
Jan 2015 年 7 月 29 日

2 投票

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 件のコメント

Ali Afruzi
Ali Afruzi 2021 年 2 月 6 日
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'.

サインインしてコメントする。

その他の回答 (1 件)

Felix Ludwig
Felix Ludwig 2015 年 7 月 30 日

0 投票

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

質問済み:

2015 年 7 月 29 日

コメント済み:

2021 年 2 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by