3D matrix of cells?
1 view (last 30 days)
Show older comments
Let's say you have a 2D grid with 9 points/nodes, each node is represented by a vector with 9 elements. I want to represent this grid as a matrix, where each element in the matrix is i vector of length 9. What is the best way to do this in Matlab? I've looked in to the cell type, but cannot for the life of me figure out how the indexing works and how to perform arithmetic with cells
1 Comment
Image Analyst
on 17 Sep 2013
Cells are confusing. The FAQ may help explain it better: http://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F
Accepted Answer
the cyclist
on 17 Sep 2013
The indexing can be a bit confusing, particularly around identifying the cell, versus the contents of the cell. Here is an example that may help.
c = cell(3,3);
for i = 1:3
for j = 1:3
c{i,j} = rand(9,1);
end
end
% The 4th element of the (3,2) position of your 2D grid.
c{3,2}(4)
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!