필터 지우기
필터 지우기

combine each 8 matrices in a cell array

조회 수: 1 (최근 30일)
MA
MA 2020년 3월 8일
편집: MA 2020년 3월 8일
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에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by