필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
Haley Albers
Haley Albers 2017년 7월 14일
댓글: Image Analyst 2017년 7월 19일
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.
Image Analyst
Image Analyst 2017년 7월 19일
And don't use assignin() - it's up there with eval() in functions not to use.

댓글을 달려면 로그인하십시오.

답변 (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