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?
2 次查看(过去 30 天)
显示 更早的评论
for eg-

i need this matrix to look like {1,9} {2,7} {3,8}.......
3 个评论
采纳的回答
Image Analyst
2018-9-14
编辑:Image Analyst
2018-9-14
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
0 个评论
更多回答(2 个)
Image Analyst
2018-9-14
Did you try something like 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, 1), m(row, col, end)];
index = index + 1;
end
end
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!