How to save a picture as a new name once a radio button is pushed using GUI

1 次查看(过去 30 天)
When I select a radio button response, I would like to automatically save the current picture present with the radio button number at the end of the picture name. Not sure how to retrieve the current name of the picture in order to save the new name.
Here is my current code:
radioChecked = get(handles.radiobutton1, 'Value');
if radioChecked == 1
axes = handles.axes1;
assignin('base','toBeSaved',axes);
[fileName, filePath] = uiputfile('*.jpg*', 'Save toBeSaved as');
fileName = fullfile(filePath, fileName);
imwrite(toBeSaved, fileName, 'jpg');
guidata(hObject, handles);
end
this just opens the browser to manually save the photo as a new name. I would like the photo name to be programmed by retrieving the current name and adding a number at the end.
  3 个评论
Don Zheng
Don Zheng 2017-7-19
编辑:Don Zheng 2017-7-19
As Adam said, the displayed image (color map data in the axes) has no tight to the original file, so there is no name to be retrieved from. You may need to consider making a cell array in your program to store the original image names in the same order as you lay out the radio buttons.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by