| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
c = cell(n)
c = cell(m, n)
c
= cell([m, n])
c = cell(m, n, p,...)
c
= cell([m n p ...])
c = cell(size(A))
c = cell(javaobj)
c = cell(n) creates an n-by-n cell array of empty matrices. An error message appears if n is not a scalar.
c = cell(m, n) or c = cell([m, n]) creates an m-by-n cell array of empty matrices. Arguments m and n must be scalars.
c = cell(m, n, p,...) or c = cell([m n p ...]) creates an m-by-n-by-p-... cell array of empty matrices. Arguments m, n, p,... must be scalars.
c = cell(size(A)) creates a cell array the same size as A containing all empty matrices.
c = cell(javaobj) converts a Java array or Java object javaobj into a MATLAB cell array. Elements of the resulting cell array will be of the MATLAB type (if any) closest to the Java array elements or Java object.
This type of cell is not related to "cell mode", a MATLAB feature used in debugging and publishing.
This example creates a cell array that is the same size as another array, A.
A = ones(2,2)
A =
1 1
1 1
c = cell(size(A))
c =
[] []
[] []The next example converts 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)
cellArray =
'one'
'two'
'three'num2cell, ones, rand, randn, zeros
![]() | ceil | cell2mat | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |