Azzera filtri
Azzera filtri

wait until picture selection.

2 visualizzazioni (ultimi 30 giorni)
Dimani4
Dimani4 il 10 Mar 2022
Commentato: Dimani4 il 12 Mar 2022
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.

Risposta accettata

Jan
Jan il 10 Mar 2022
Modificato: Jan il 10 Mar 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
  1 Commento
Dimani4
Dimani4 il 12 Mar 2022
Thank you very much!!!!! Great solution!!!!

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Interactive Control and Callbacks in Help Center e File Exchange

Prodotti


Release

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by