Make two cell vector in one
조회 수: 4 (최근 30일)
이전 댓글 표시
I have two cell arrays A and B, each of size 1x5 cells. Each cell is a row vector with same size (A{1}=B{1}=1x5 vector, A{2}=B{2}=1x5 vector...) where each cell in A is the same size of the corresponding cell in B. How can I add C=[A B]?
A = [{rand(1,5)} {rand(1,5)}];
B = [{rand(1,5)} {rand(1,5)}];
I need C=[{rand(1,10)} {rand(1,10)}]
댓글 수: 0
채택된 답변
Rik
2023년 8월 30일
A simple loop will do:
A = {rand(1,5) , rand(1,5)};
B = {rand(1,5) , rand(1,5)};
C = cell(size(A));
for n=1:numel(C)
C{n} = [A{n} B{n}];
end
C
댓글 수: 2
Image Analyst
2023년 8월 30일
If this Answer solves your original question, then could you please click the "Accept this answer" link to award the answerer with "reputation points" for their efforts in helping you? They'd appreciate it. Thanks in advance. 🙂 Note: you can only accept one answer (so pick the best one) but you can click the "Vote" icon for as many Answers as you want. Voting for an answer will also award reputation points.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!