MATLAB Answers

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

20 views (last 30 days)
Isti
Isti on 29 Apr 2012
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 :')

  0 Comments

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 29 Apr 2012
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 Comments

Isti
Isti on 29 Apr 2012
could you give a kind of example how to use uiputfile(), fullfile()?
Walter Roberson
Walter Roberson on 29 Apr 2012
[filename, pathname] = uiputfile('*.xls', 'Choose a file name');
outname = fullfile(pathname, filename);
xlswrite(outname, M);

Sign in to comment.

More Answers (0)

Sign in to answer this question.


Translated by