matlab中运用GUI的菜单来编写另存为函数

1.保存类型:图片如png、jpg、bmp等格式
2.图片说明 保存的代码已用imwrite写了,问题在于另存为的代码如何编写。
保存代码:

function savenoise_Callback(hObject, eventdata, handles)
% hObject    handle to savenoise (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

global Y;%Y为加噪后的图像文件
imwrite(Y,'noise.jpg','jpg');

% --------------------------------------------------------------------
function savefiter_Callback(hObject, eventdata, handles)
% hObject    handle to savefiter (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

global Z;%Z为滤波后图像文件
imwrite(Z,'filter.jpg','jpg');

有没有大佬能帮忙弄出个另存为代码,要求可以选择保存文件路径与保存的图像类型

https://jingyan.baidu.com/article/456c463b580a700a583144da.html