For a 1-by-N array, they are essentially the same. For a multidimensional array M, they can give different results:
numel(M)is equivalent toprod(size(M)).length(M)is equivalent tomax(size(M)). IfMis empty (i.e. any dimension is 0), thenlength(M)is 0.