Clear Filters
Clear Filters

Cancel the beep and an error msg in GUI button cancellation

1 view (last 30 days)
I created a save2XLS button in GUI that contain the following code:
[filename,pathname]= uiputfile('*.xls','Save as');
column=get(handles.foTable,'columnname')' ;
dataX=get(handles.foTable,'data');
num=[column;dataX];
fullFileName = [pathname filename]
if exist(fullFileName)
%overwrite the file
delete([pathname filename])
xlswrite([pathname filename],num);
else
%write new file
xlswrite([pathname filename],num);
end
If I decide to cancel the "save as" operation by clicking the X or the cancel button I get a beep and an error in the command window. How can I cancel it?
Thanks

Accepted Answer

Image Analyst
Image Analyst on 7 May 2013
Bail out if they click cancel
if filename == 0
return;
end

More Answers (0)

Community Treasure Hunt

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

Start Hunting!