How to give a name to xlswrite with a dialogue box? (gui)

1 回表示 (過去 30 日間)
Isti
Isti 2012 年 4 月 29 日
Let say i have an matrix M. Then i want to make a excel file which contain this matrix M. The things that i usually use is a kind of static and manually with: xlswrite('test.xls',M).
I don't know how to make a flexible one. What I mean is, when i click "save" in my GUI figure, there'll some kind of dialogue box appear then i will give the name of it's excel file.
What to do? Thanks before :')

採用された回答

Walter Roberson
Walter Roberson 2012 年 4 月 29 日
Use uiputfile() to get a target file name and target directory. Use fullfile() to splice the two name parts together to get a complete pathname. Pass that pathname to xlswrite()
  2 件のコメント
Isti
Isti 2012 年 4 月 29 日
could you give a kind of example how to use uiputfile(), fullfile()?
Walter Roberson
Walter Roberson 2012 年 4 月 29 日
[filename, pathname] = uiputfile('*.xls', 'Choose a file name');
outname = fullfile(pathname, filename);
xlswrite(outname, M);

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by