MATLAB: I have a 48*48*3 matrix , i want to convert it to 48*48 matrix where each element of the matrix will show a list of 3 characters in a cell. how to do it

matrix

for eg-
i need this matrix to look like {1,9} {2,7} {3,8}…….

Best Answer

For all the numbers, you can try this:
[rows, columns, numSlices] = size(m);
index = 1;
ca = cell(1, rows*columns); % Preallocate
for row = 1 : rows
for col = 1 : columns
ca{index} = m(row, col, :);
index = index + 1;
end
end