function [] = fc_update_slider(activ, plot_coords, circular_plot_axes, activ_plot_axes)
% Function to update the value of a slider (using handle passed to
% function) with the value entered in an editbox (using other handle). The
% function checks that the value in editbox is numeric (if it isn't, the
% editbox and slider are set to 0), and that it doesn't exceed the slider's
% max or min values.
value = str2num(get(findobj('tag', 'animation_frame_editbox'), 'String'));
% Check the user has enetered numbers - if there are any other chars,
% str2num returns []
if isempty(value)
set(findobj('tag', 'animation_frame_editbox'), 'String', '1');
set(findobj('tag', 'animation_slider'), 'Value', 1);
return;
end
max = get(findobj('tag', 'animation_slider'), 'Max');
min = get(findobj('tag', 'animation_slider'), 'Min');
if value > max
set(findobj('tag', 'animation_frame_editbox'), 'String', num2str(max));
set(findobj('tag', 'animation_slider'), 'Value', max);
return;
elseif value < min
set(findobj('tag', 'animation_frame_editbox'), 'String', num2str(max));
set(findobj('tag', 'animation_slider'), 'Value', max);
return;
else
set(findobj('tag', 'animation_slider'), 'Value', value);
end
fc_setFrame_circle(activ, plot_coords, str2num(get(findobj('tag', 'animation_frame_editbox'), 'string')), circular_plot_axes);
fc_plot_activ(activ, activ_plot_axes, str2num(get(findobj('tag', 'animation_frame_editbox'), 'string')));
return;