Adding a cell to another cell in a specific position
조회 수: 1 (최근 30일)
이전 댓글 표시
I have two cells:
A(n x 1)
B(m x 1)
I'd like to add cell B to cell A in a specific position of A.
Do you have any suggestion?
댓글 수: 0
채택된 답변
Rik
2021년 3월 29일
What do you mean exactly by adding?
%create some data
n=3;m=5;
A=num2cell(1:n).';
B=num2cell(2*n+(1:m)).';
%option 1:
A1=A;
A1{2}=B;
disp(A1)
%option 2:
k=2;A2=A;
A2=[A2(1:k);B;A2((k+1):end)];
disp(A2)
댓글 수: 2
Rik
2021년 3월 29일
If my answer solved your issue, please consider marking it as accepted answer. If not, feel free to comment with your remaining questions.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!