function x = getsetvar(handle, mini, maxi, isint, lu)
x = str2num(get(handle,'String'));
if isint == 1
    x = round(x);
end

if (x < mini) || (x > maxi)
    if lu == 0
        x = min(mini, max(maxi, x));
    elseif lu == 1
        x = max(mini, min(maxi, x));
    else
        if x < mini
            x = min(mini, max(maxi, x));
        else
            x = max(mini, min(maxi, x));
        end
    end
    set(handle,'String',num2str(x));
end
