MATLAB: How to get information that a ‘uisave’ command was aborted

MATLABsaveuisave

Hi,
I want to save certain variables in a mat file using specific name in a chosen directory.
For that I use 'uisave'. I could use uiputfile but I need only few variables out of many in the work space.
After this is done I want to write a message: 'Save finished successfully'.
In the case where the user aborted the save dialog box I want to konw it so I can write 'Save was aborted by user'.
How can I get the information that the user pushd 'Cancel' istead of 'Save'?
Thanks,
Alon

Best Answer

No can do. Less than primo "Quality of Implemenation" that TMW didn't have an optional return value from uisave
>> fn=uisave('R','Temp')
Error using uisave
Too many output arguments.
>>
Worth an enhancement request/bug report.
It is an m-file, and is a wrapper around a call to uiputfile however, so one could make a local version of your own that does return the file variable to test for 0 as does uiputfile or modify it to return a flag/logical variable. The dual use of the file name as the logical is also a marginal design by current thinking but was prevalent in the time the original was written. Hence is probably best choice for consistency in keeping with existing functions.
The user can modify the filename in the uisave dialog, so that is another reason it would be best choice to return the filename so can also know if the user changed the default name.
ADDENDUM:
Never used so had to go look at what it actually does. All would take would be to change the existing function definition line from
function uisave(variables, filename)
to
function [fn,pn,filterindex]=uisave(variables, filename)
which would give the same return values as one gets from uiputfile.