Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
Haley Albers
Haley Albers le 14 Juil 2017
Commenté : Image Analyst le 19 Juil 2017
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 commentaires
Don Zheng
Don Zheng le 19 Juil 2017
Modifié(e) : Don Zheng le 19 Juil 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.
Image Analyst
Image Analyst le 19 Juil 2017
And don't use assignin() - it's up there with eval() in functions not to use.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by