Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
converting values in cell array
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a cell array A A = [(1 2 3), (5 6 7), (13 14 15)]
I want to convert it so it count sequentially and creates another cell array
B = [(1 2 3), (4 5 6), (7 8 9)]
thanks
댓글 수: 0
답변 (1개)
Kirby Fears
2015년 10월 8일
I can't imagine a use-case for this, but here you go:
A = {[1,2,3],[5,6,7],[13,14,15]};
B = cell(size(A));
counter=0;
for iter = 1:numel(A),
B{iter} = counter + (1:numel(A{iter}));
counter=counter + numel(A{iter});
end
Hope this helps.
댓글 수: 0
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!