combine each 8 matrices in a cell array

1 次查看(过去 30 天)
I have a cell array that contain matrices of the same dimentions. I want an effictive way to combine each 8 matrices together in one matrix. Any ideas?

采纳的回答

Image Analyst
Image Analyst 2020-3-8
How about just a loop? Assuming a 1-D cell array
caOut = cell(length(ca)/8, 1); % New cell array for the output
counter = 1;
for k = 1 : 8 : length(ca)
% Put 8 cells of ca into one cell of caOut.
caOut(counter) = {[ca{k}, ca{k+1}, ca{k+2}, ca{k+3}, ca{k+4}, ca{k+5}, ca{k+6}, ca{k+7}]}
counter = counter + 1;
end
  1 个评论
MA
MA 2020-3-8
编辑:MA 2020-3-8
thanks this helps. I replaced the thing inside the loop as the following
{cat(1, ca{k:K+8-1)})};

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by