Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
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 comentarios
Don Zheng
Don Zheng el 19 de Jul. de 2017
Editada: Don Zheng el 19 de Jul. de 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 el 19 de Jul. de 2017
And don't use assignin() - it's up there with eval() in functions not to use.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by