MATLAB: How to send data in edit box to different fig. window.

data sendMATLAB

Hi,
I like to send a value of editbox in A fig. to B. fig. With the value, I like to set max of a slider.
I successed this in the same figure window, but failed in differents figure windows.
if anyone know, please let me know.
Thansk.

Best Answer

Edit: Missing brackets corrected, thanks to Paulo's keen eye. Also, missed a 'Parent' I meant to include.
Matlab doesn't care which figure the control is in: it just needs the handle of the control.
fig2 = figure(2);
slideh = uicontrol('Style','slider','Parent',fig2);
fig3 = figure(3);
eb = uicontrol('Style','edit', 'Parent', fig3, 'Callback', ...
@(src,event) set(slideh, 'Value',str2double(get(src,'String'))));
Or even
fig2 = figure(2);
slideh = uicontrol('Style','slider','Parent',fig2, 'Tag', 'Here');
fig3 = figure(3);
eb = uicontrol('Style','edit', 'Callback', ...
@(src,event) set(findobj(0, 'Tag', 'Here'), ...
'Value',str2double(get(src,'String'))));
The problem with your code is that there is no type 'slider'. Sliders are 'type' 'uicontrol', with 'style' 'slider'