wait until picture selection.
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi people,
I have some gui program in matlab. I create some pictures. Then I want to do profile on the pictures. I created push button, say "Manual profile". I push this button and then I want to program to wait until I will select between some pictures I already created.
function pushbutton15_Callback(hObject, eventdata, handles) %(manual profile button)
% hObject handle to pushbutton15 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%? what should be here?
% Here I want to wait until I select some picture
Then my purpose is to get handle to the selected figure and pass it to the function of improfile. In that way I want to create the profile on selected picture.
Thank you very much.
0 Kommentare
Akzeptierte Antwort
Jan
am 10 Mär. 2022
Bearbeitet: Jan
am 10 Mär. 2022
You could add a button "Select this" to all open figures:
function pushbutton15_Callback(hObject, eventdata, handles)
openFig = get(groot, 'Children');
hButton = gobjects(1, numel(openFig));
hFig = ancestor(hObject, 'Figure');
for k = 1:numel(openFig)
hButton(k) = uicontrol(openFig(k), 'Style', 'PushButton', ...
'String', 'Select', ...
'Callback', {@selectBtn_Callback, handles, hFig});
end
setappdata(hFig, 'SelectButton', hButton);
end
function selectBtn_Callback(hObject, eventdata, handles, hFig)
hSelectedFigure = ancestor(hObject, 'Figure');
hButton = getappdata(hFig, 'SelectButton');
delete(hButton);
setappdata(hFig, 'SelectButton', []);
... do with hSelectedFigure what you want now
end
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Code Execution finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!