20.08.2015 Views

MATLAB array manipulation tips and tricks

MATLAB array manipulation tips and tricks - Home - Online.no

MATLAB array manipulation tips and tricks - Home - Online.no

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 2. OPERATORS, FUNCTIONS AND SPECIAL CHARACTERS 42.2 Built-in functionsallanycumsumdiagdiffendeyefindisemptyisequalisfiniteisinfislogicalisnanisnumericlengthlogicalndimsnumelonespermuteprodreshapesizesortsumtriltriuzerosTrue if all elements of a vector are nonzero.True if any element of a vector is nonzero.Cumulative sum of elements.Diagonal matrices <strong>and</strong> diagonals of a matrix.Difference <strong>and</strong> approximate derivative.Last index in an indexing expression.Identity matrix.Find indices of nonzero elements.True for empty matrix.True if <strong>array</strong>s are numerically equal.True for finite elements.True for infinite elements.True for logical <strong>array</strong>.True for Not-a-Number.True for numeric <strong>array</strong>s.Length of vector.Convert numeric values to logical.Number of dimensions.Number of elements in a matrix.Ones <strong>array</strong>.Permute <strong>array</strong> dimensions.Product of elements.Change size.Size of matrix.Sort in ascending order.Sum of elements.Extract lower triangular part.Extract upper triangular part.Zeros <strong>array</strong>.Some of these functions are shorth<strong>and</strong>s for combinations of other built-in functions, liklength(x) is max(size(x))ndims(x) is length(size(x))numel(x) is prod(size(x))Others are shorth<strong>and</strong>s for frequently used tests, likeisempty(x) is numel(x) == 0isinf(x) is abs(x) == Infisfinite(x) is abs(x) ~= InfOthers are shorth<strong>and</strong>s for frequently used functions which could have been written with low-levelcode, like diag, eye, find, sum, cumsum, cumprod, sort, tril, triu, etc.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!