Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
24
Добавлен:
09.02.2015
Размер:
336.38 Кб
Скачать

Cell array functions

<cell> - Create cell array.

CELL Create cell array.

CELL(N) is an N-by-N cell array of empty matrices.

CELL(M,N) or CELL([M,N]) is an M-by-N cell array of empty

matrices.

CELL(M,N,P,...) or CELL([M N P ...]) is an M-by-N-by-P-by-...

cell array of empty matrices.

CELL(SIZE(A)) is a cell array the same size as A containing

all empty matrices.

See also ones, zeros, struct, deal, paren.

Overloaded methods:

distributed/cell

codistributor2dbc/cell

codistributor1d/cell

codistributed/cell

sweepset/cell

Reference page in Help browser

doc cell

<celldisp> - Display cell array contents.

CELLDISP Display cell array contents.

CELLDISP(C) recursively displays the contents of a cell array.

CELLDISP(C,NAME) uses the string NAME for the display instead of the

name of the first input (or 'ans').

See also cellplot.

Overloaded methods:

codistributed/celldisp

Reference page in Help browser

doc celldisp

<cellplot> - Display graphical depiction of cell array.

CELLPLOT Display graphical depiction of cell array.

CELLPLOT(C) displays the structure of a cell array as nested

colored boxes.

H = CELLPLOT(C) returns a vector of surface, line and text handles.

H = CELLPLOT(C,'legend') also puts a legend next to the plot.

Reference page in Help browser

doc cellplot

<cell2mat> - Convert the contents of a cell array into a single matrix.

CELL2MAT Convert the contents of a cell array into a single matrix.

M = CELL2MAT(C) converts a multidimensional cell array with contents of

the same data type into a single matrix. The contents of C must be able

to concatenate into a hyperrectangle. Moreover, for each pair of

neighboring cells, the dimensions of the cell's contents must match,

excluding the dimension in which the cells are neighbors. This constraint

must hold true for neighboring cells along all of the cell array's

dimensions.

The dimensionality of M, i.e. the number of dimensions of M, will match

the highest dimensionality contained in the cell array.

CELL2MAT is not supported for cell arrays containing cell arrays or

objects.

Example:

C = {[1] [2 3 4]; [5; 9] [6 7 8; 10 11 12]};

M = cell2mat(C)

See also mat2cell, num2cell

Overloaded methods:

codistributed/cell2mat

Reference page in Help browser

doc cell2mat

<mat2cell> - Break matrix up into a cell array of matrices.

MAT2CELL Break matrix up into a cell array of matrices.

C = MAT2CELL(X,M,N) breaks up the 2-D array X into a cell array of

adjacent submatrices of X. X is an array of size [ROW COL], M is the

Vector of row sizes (must sum to row) and n is the vector of column

sizes (must sum to COL). The elements of M and N determine the size of

each cell in C by satisfying the following formula for I = 1:LENGTH(M)

and J = 1:LENGTH(N),

SIZE(C{I,J}) == [M(I) N(J)]

C = MAT2CELL(X,D1,D2,D3,...,DN) breaks up the multidimensional array X

and returns a multidimensional cell array of adjacent submatrices of X.

Each of the vector arguments, D1 through DN, should sum to the

respective dimension sizes of X, such that for P = 1:N,

SIZE(X,P) == SUM(DP)

The elements of D1 through DN determine the size of each cell in C by

satisfying the formula for IP = 1:LENGTH(DP),

SIZE(C{I1,I2,I3,...,IN}) == [D1(I1) D2(I2) D3(I3) ... DN(IN)]

C = MAT2CELL(X,R) breaks up an array X by returning a single column

cell array, containing the rows of X. R must sum to the number of rows

of X. The elements of R determine the size of each cell in C, subject

to the following formula for I = 1:LENGTH(R),

SIZE(C{I},1) == R(I)

C = MAT2CELL(X,...,[],...) will return an empty cell array whose empty

size matches the lengths of the vector arguments, D1 through DN. Note

that the length of an empty vector is zero.

MAT2CELL supports all array types.

Example:

X = [1 2 3 4; 5 6 7 8; 9 10 11 12];

C = mat2cell(X,[1 2],[1 3])

See also cell2mat, num2cell

Overloaded methods:

codistributed/mat2cell

Reference page in Help browser

doc mat2cell

<num2cell> - Convert numeric array into cell array.

NUM2CELL Convert numeric array into cell array.

C = NUM2CELL(A) converts numeric array A into cell array C by placing

each element of A into a separate cell in C. The output array has the

same size and dimensions as the input array. Each cell in C contains

the same numeric value as its respective element in A.

C = NUM2CELL(A, DIM) converts numeric array A into a cell array of

numeric vectors, the dimensions of which depend on the value of the DIM

argument. Return value C contains NUMEL(A)/SIZE(A,DIM) vectors, each of

length SIZE(A, DIM). The DIM input must be an integer with a value from

NDIMS(A) to 1.

C = NUM2CELL(A, [DIM1, DIM2, ...]) converts numeric array A into a cell

array of numeric arrays, the dimensions of which depend on the values

of arguments [DIM1, DIM2, ...]. Given the variables X and Y, where

X=SIZE(A,DIM1) and Y=SIZE(A,DIM2), return value C contains

NUMEL(A)/PROD(X,Y,...) arrays, each of size X-by-Y-by-.... All DIMn

inputs must be an integer with a value from NDIMS(A) to 1.

NUM2CELL works for all array types.

Use CELL2MAT or CAT(DIM,C{:}) to convert back.

See also mat2cell, cell2mat

Overloaded methods:

codistributed/num2cell

Reference page in Help browser

doc num2cell

<deal> - Deal inputs to outputs.

DEAL Deal inputs to outputs.

[A,B,C,...] = DEAL(X,Y,Z,...) simply matches up the input and

output lists. It is the same as A=X, B=Y, C=Z, ...

[A,B,C,...] = DEAL(X) copies the single input to all

the requested outputs. It is the same as A=X, B=X, C=X, ...

DEAL is most useful when used with cell arrays and structures

via comma separated list expansion. Here are some useful

constructions:

[S.FIELD] = DEAL(X) sets all the fields with the name FIELD

in the structure array S to the value X. If S doesn't

exist, use [S(1:M).FIELD] = DEAL(X);

[X{:}] = DEAL(A.FIELD) copies the values of the field with

name FIELD to the cell array X. If X doesn't exist,

use [X{1:M}] = DEAL(A.FIELD).

[A,B,C,...] = DEAL(X{:}) copies the contents of the cell

array X to the separate variables A,B,C,...

[A,B,C,...] = DEAL(S.FIELD) copies the contents of the fields

with the name FIELD to separate variables A,B,C,...

Examples:

sys = {rand(3) ones(3,1) eye(3) zeros(3,1)};

[a,b,c,d] = deal(sys{:});

direc = dir; filenames = {};

[filenames{1:length(direc),1}] = deal(direc.name);

See also lists, paren.

Reference page in Help browser

doc deal

<cell2struct> - Convert cell array into structure array.

CELL2STRUCT Convert cell array to structure array.

S = CELL2STRUCT(C,FIELDS,DIM) converts the cell array C into

the structure S by folding the dimension DIM of C into fields of

S. SIZE(C,DIM) must match the number of field names in FIELDS.

FIELDS can be a character array or a cell array of strings.

Example:

c = {'tree',37.4,'birch'};

f = {'category','height','name'};

s = cell2struct(c,f,2);

See also struct2cell, fieldnames.

Overloaded methods:

codistributed/cell2struct

Reference page in Help browser

doc cell2struct

<struct2cell> - Convert structure array into cell array.

STRUCT2CELL Convert structure array to cell array.

C = STRUCT2CELL(S) converts the M-by-N structure S (with P fields)

into a P-by-M-by-N cell array C.

If S is N-D, C will have size [P SIZE(S)].

Example:

clear s, s.category = 'tree'; s.height = 37.4; s.name = 'birch';

c = struct2cell(s); f = fieldnames(s);

See also cell2struct, fieldnames.

Overloaded methods:

codistributed/struct2cell

Reference page in Help browser

doc struct2cell

<iscell> - True for cell array.

ISCELL True for cell array.

ISCELL(C) returns logical true (1) if C is a cell array

and logical false (0) otherwise.

See also cell, paren, isstruct, isnumeric, isobject, islogical.

Reference page in Help browser

doc iscell

Соседние файлы в папке Библиотеки Matlab