Clear Filters
Clear Filters

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

1 view (last 30 days)
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 Comments
Don Zheng
Don Zheng on 19 Jul 2017
Edited: Don Zheng on 19 Jul 2017
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.

Sign in to comment.

Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!