cell2mat
Converts a cell array to a matrix.
Syntax
R = cell2mat(a)
Inputs
- a
- Cell array to be converted. The individual elements of the cell must be conformable to matrix creation.
Outputs
- a
- Resulting matrix.
Examples
a = {1:4};
R = cell2mat(a)
R = [Matrix] 1 x 4
1 2 3 4
b = [1,2;3,4];
c = {b, b+1;b+2, b+3};
R = cell2mat(c)
R = [Matrix] 4 x 4
1 2 2 3
3 4 4 5
3 4 4 5
5 6 6 7
b = [1,2;3,4];
d = [b [5;6]];
e = {b, d; d+1, b+1};
R = cell2mat(e)
R = [Matrix] 4 x 5
1 2 1 2 5
3 4 3 4 6
2 3 6 2 3
4 5 7 4 5
Comments
The individual elements of the input cell array do not have to be conformable, but all rows must have the same number of total columns.