MATLAB: How to recover data stored in cells

cellcell arraycell arrays

Hello, I have been doing some work in Matlab and I am unfamiliar with using cells. I would like to know how to access data which I have stored in cells. I have tried cell2mat(), but I get the following error:
Error using cell2mat (line 52) CELL2MAT does not support cell arrays containing cell arrays or objects.
if true
% cx = centerxFinal;
% cy = centeryFinal;
% rad = radiusFinal;
%

% columns = size(centeryFinal,2);
% rows = size(centeryFinal,1);
%
% for i = 1:columns-1

% for j = 1:rows

% for k = 1:rows
% if ((cy(j,i+1) ~= 0 && cy(k,i) ~= 0) && (cx(j,i+1) ~= 0 && cx(k,i) ~= 0))
% y_dist(j,i,k) = cy(j,i+1)-cy(k,i);
% xy_points{j,i,k} = {[centeryFinal(j,i+1),centeryFinal(k,i)],[centerxFinal(j,i+1),centerxFinal(k,i)]};
% x_dist(j,i,k) = cx(j,i+1)-cx(k,i);
% else
% xy_points{j,i,k} = 0;
% end


% end

% end

% end
% for i = 1:columns-1
% for j = 1:rows
% for k = 1:size(xy_points,3)
% if y_dist(j,i,k) > 50 || y_dist(j,i,k) < -50
% xy_points{j,i,k} =0;

% end
% if x_dist(j,i,k) <= 0 || x_dist(j,i,k) < 400
% xy_points{j,i,k} =0;
% end
% end
% end
% end
end
The result of this script is a three dimensional cell containing cells which cointain pairs of points.
Is there a function or algorithmic process I can use to retrieve the data points that have survived the filtering process?

Best Answer

To recover data stored in cells, you also use the braces again:
cellContents = xy_points{j,i,k};
I see no reason in your code to mess with cells at all. You don't have stuff of variable type or size. To make it even more confusing, it seems like the variable editor is saying you have cells inside of cells. How confusing is that?
See the FAQ for a good intuitive discussion of what cells are: http://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F