user interface - How to send data from child figure to its parent in matlab? -
i have "main" figure in matlab project opens "settings" figure. user can change fields in settings figure , press "apply" button in settings figure. want send settings data settings figure main figure when apply button pressed.
i set apply button's callback update settings figure's handles.output fields , in main figure assigned output variable while calling settings figure.
function apply_callback(hobject, eventdata, handles) handles.output = [str2num(get(handles.precinp, 'string')) get(handles.plotcheck, 'value') get(handles.stepcheck, 'value') get(handles.speedslid, 'value')]; guidata(hobject, handles);
and how open settings figure main figure:
function settingsbutton_callback(hobject, eventdata, handles) handles.settingsdata = cell2mat(settings()); guidata(hobject, handles);
so assignment occurs when settings figure opened, want when apply button pressed
try using uiwait
after create settings dialog, , uiresume
after apply button clicked. need pick figure handle wait on. logical choice figure handle corresponding settings dialog (see docs). allow settingsbutton_callback
function block until apply button clicked.
you might consider using handle class settings dialog, in case store settings properties rather returning cell array via handles.output
.
Comments
Post a Comment