How can I get information that a 'uisave' command was aborted?
Show older comments
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
Accepted Answer
More Answers (1)
Alon Rozen
on 12 Feb 2020
0 votes
2 Comments
Don't change the TMW-supplied function, create a copy of it in a place on your user working path and make the modifications therein. Also rename it to something slightly different so it doesn't alias the builtin function as well.
Then, you supply this new function as part of your application just like any of the other functions you've built.
One way to package it would be to include it in the m-file that uses it--then it is private to that file alone (presuming the call in your app is localized to one location). If that isn't so, then you can always create a private subdirectory for it to go along with your distributed file(s). Or leave it public but give it a unique name just as if you were to "roll your own" from scratch not knowing TMW had supplied uisave at all.
I didn't bother to make the change above but as noted here and there, don't use the name uisave but
function [fn,pn,filterindex]=my_uisave(variables, filename)
or some other way to make it unique.
Alon Rozen
on 12 Feb 2020
Categories
Find more on Adding custom doc in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!