view general/arrutils/numdims.m @ 13:03694e5c8365

Reorganised some high order list functions to correct class-based method dispatch; fixed some docs.
author samer
date Wed, 16 Jan 2013 12:12:34 +0000
parents e44f49929e56
children
line wrap: on
line source
function n=numdims(x)
% numdims - Dimension of multidimensional array
%
% numdims :: [Size] -> natural.
%
% n=numdims(x), where n=length(size1(x)), ie not counting any
% trailing singleton dimensions. Eg
%    numdims(1)=0
%    numdims([1;2;3])=1
%    numdims([1 2 3])=2

sz=size(x);
n=length(sz);
while n>0 && sz(n)==1, n=n-1; end;