
function [Dia] = NextSize(OldDia, AllowableShaftSize)

%  This routine searches the AvailableShaftSize for the next larger size in
%  the table.

[a, ArrayLength] = size(AllowableShaftSize);

Found = 0;

for i = 1: ArrayLength;
    Dia = AllowableShaftSize (i);
    if (Dia > OldDia)
        Found = 1;
        break;
    end
end

if (Found == 0)
    error ('NextSize', 'Could not find a larger size diameter\n')
end
end
