| Contents | Index |
C = cell(dim)
C = cell(dim1,...,dimN)
D = cell(obj)
C = cell(dim) creates a cell array of empty matrices. If dim is a scalar, C is dim-by-dim. If dim is a vector, C is dim(1)-by-...-dim(N), where N is the number of elements of dim.
C = cell(dim1,...,dimN) creates cell array C, where C is dim1-by-...-dimN.
D = cell(obj) converts a Java array or .NET array of System.String or System.Object into a MATLAB cell array.
Creating an empty array with the cell function, such as
C = cell(3,4,2);
is exactly equivalent to assigning an empty array to the last index of a new cell array:
C{3,4,2} = [];C |
Cell array. Each cell contains an empty, 0-by-0 array of type double. |
D |
Cell array. Each cell contains a MATLAB type closest to the Java or .NET type. For more information, see:
|
Create an empty 3-by-4-by-2 cell array.
mycell = cell(3,4,2);
Create a cell array that is the same size as mycell, created in the previous example.
similar = cell(size(mycell));
Convert an array of java.lang.String objects into a MATLAB cell array.
strArray = java_array('java.lang.String', 3);
strArray(1) = java.lang.String('one');
strArray(2) = java.lang.String('two');
strArray(3) = java.lang.String('three');
cellArray = cell(strArray)This code returns
cellArray =
'one'
'two'
'three'Create a cell array of folders in the c:\work folder, using the .NET Framework System.IO.Directory class :
myList = cell(System.IO.Directory.GetDirectories('c:\work'));
celldisp(myList)num2cell | ones | rand | randn | zeros

Explore how to use MATLAB to make advancements in engineering and science.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |