function Z = null(A,how) %#ok<INUSD>
%MATLAB Code Generation Library Function

%   Limitations:
%   1. Rational basis option (second input) is not supported.
%   2. May return a different basis than MATLAB.

%   Copyright 1984-2016 The MathWorks, Inc.
%#codegen

eml_invariant(nargin > 0, ...
    'MATLAB:minrhs');
eml_invariant(nargin < 2, ...
    'Coder:toolbox:null_2', ...
    'IfNotConst','Fail');
% Orthonormal basis
if coder.internal.anyNonFinite(A)
    Z = coder.internal.nan(size(A,2),size(A,2),'like',A);
else
    [~,s,V] = coder.internal.svd(A,0);
    [m,n] = size(A);
    if m < n
        ns = m;
        maxmn = n;
    else
        ns = n;
        maxmn = m;
    end
    r = ones(coder.internal.indexIntClass);
    if ns > 0
        tol = maxmn*eps(s(1));
        for k = 1:ns
            r = r + coder.internal.indexInt(s(k)>tol);
        end
    end
    assert(r <= ns+1); %<HINT>
    Z = V(:,r:n);
end
