function n = ndim(X)
    n = max(1,sum(size(X)>1))*(~isempty(X));
    
end