有用的Matlab内置函数(3)

numel – Number of elements in array or subscripted array expression
Syntax

n = numel(A)
n = numel(A, index1, index2, ... indexn)

Description
n = numel(A) returns the number of elements, n, in array A.
n = numel(A, index1, index2, … indexn) returns the number of subscripted elements, n, in A(index1, index2, …, indexn). To handle the variable number of arguments, numel is typically written with the header function n = numel(A, varargin), where varargin is a cell array with elements index1, index2, … indexn.

not – Logical NOT ~

cat – Concatenate arrays along specified dimension
Syntax

C = cat(dim, A, B)
C = cat(dim, A1, A2, A3, A4, ...)

Description
C = cat(dim, A, B)concatenates the arrays A and B along array dimension dim.
C = cat(dim, A1, A2, A3, A4, …)concatenates all the input arrays (A1, A2, A3, A4, and so on) along array dimension dim.
For nonempty arrays, cat(2, A, B) is the same as [A, B], and cat(1, A, B) is the same as [A; B]

rand Uniformly distributed pseudorandom numbers
Syntax

r = rand(n)
r = rand(m,n)
r = rand([m,n])
r = rand(m,n,p,...)
r = rand([m,n,p,...])
r = rand
r = rand(size(A))
r = rand(..., 'double')
r = rand(..., 'single')

Description
r = rand(n) returns an n-by-n matrix containing pseudorandom values drawn from the standard uniform distribution on the open interval (0,1).
r = rand(m,n) or r = rand([m,n]) returns an m-by-n matrix.

 

ind = find(X) locates all nonzero elements of array X, and returns the linear indices of those elements in vector ind. If X is a row vector, then ind is a row vector; otherwise, ind is a column vector. If X contains no nonzero elements or is an empty array, then ind is an empty array.

prod – Product of array elements

Syntax

B = prod(A)
B = prod(A,dim)
B = prod(A,'double')
B = prod(A,'native')

Description
B = prod(A) returns the products along different dimensions of an array. A can be double or single. B is multiplied natively, that is in the same class as A, and B has the same class as A.
If A is a vector, prod(A) returns the product of the elements.
If A is a matrix, prod(A) treats the columns of A as vectors, returning a row vector of the products of each column.
If A is a multidimensional array, prod(A) treats the values along the first non-singleton dimension as vectors, returning an array of row vectors.
B = prod(A,dim) takes the products along the dimension of A specified by scalar dim.
B = prod(A,’double’) multiplies B in double and B has class double, even if A is single.
B = prod(A,’native’) multiplies B natively and B has the same class as A.
bsxfun – Apply element-by-element binary operation to two arrays with singleton expansion enabled

Syntax

C = bsxfun(fun,A,B)

Description

C = bsxfun(fun,A,B) applies an element-by-element binary operation to arrays A and B, with singleton expansion enabled. The inputs must be of the following types: numeric, logical, char, struct, cell.fun is a function handle, and can either be an MATLAB-function or one of the following built-in functions:

  • @plus  Plus
  • @minus  Minus
  • @times  Array multiply
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

生活在西班牙

自己动手丰衣足食

BlueAsteroid

Just another WordPress.com site

Jing's Blog

Just another WordPress.com site

Start from here......

我的心情魔方

天才遠私廚

希望能做一個分享各種資訊的好地方

语义噪声

西瓜大丸子汤的博客

笑对人生,傲立寰宇

Just another WordPress.com site

Where On Earth Is Waldo?

A Project By Melanie Coles

the Serious Computer Vision Blog

A blog about computer vision and serious stuff

Cauthy's Blog

paper review...

Cornell Computer Vision Seminar Blog

Blog for CS 7670 - Special Topics in Computer Vision

datarazzi

Life through nerd-colored glasses

Luciana Haill

Brainwaves Augmenting Consciousness

槑烎

1,2,∞

Dr Paul Tennent

and the university of nottingham

turn off the lights, please

A bunch of random, thinned and stateless thoughts around the Web

%d bloggers like this: