Описание тега cell-array
In MATLAB cell arrays are a built-in container class allowing for the storage of different types of data in each "cell" of the array.
A cell array is a matlab data type with indexed data containers called cells, where each cell can contain any type of data. Cell arrays commonly contain either lists of text strings, combinations of text and numbers, or numeric arrays of different sizes.
You can refer to subsets of cells by enclosing indices in smooth parentheses, ()
. The cell contents can be accessed by indexing with curly braces, {}
.
Examples:
>> ca = cell(2, 3); % create 2-by-3 cell array with empty cells
>> ca{1, 1} = 3; % store a double scalar in one cell
>> ca{1, 2} = rand(3, 4); % store an entire matrix into a cell
>> ca{1, 3} = 'will you look at that, a string in a cell!';
>> ca{2, 1} = @mean; % a function handle can also be stored in a cell
>> ca{2, 3} = uint32(45); % store a uint32 scalar
>> ca(1, 1:3) % Get a subset of cells (first row)
ans =
1×3 cell array
[3] [3×4 double] 'will you look at that, a string in a cell!'
>> ca{1, 2} % Get the contents of a cell
ans =
0.8147 0.9134 0.2785 0.9649
0.9058 0.6324 0.5469 0.1576
0.1270 0.0975 0.9575 0.9706