Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

converting values in cell array

조회 수: 1 (최근 30일)
shobhit mehrotra
shobhit mehrotra 2015년 10월 7일
마감: MATLAB Answer Bot 2021년 8월 20일
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

답변 (1개)

Kirby Fears
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.

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by