How to delete value array and sum the residual value?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello, I have two array a=[5,6,7,3,4,1,4,3,1,4,8] and b=[4,1,1,5,3,6,1,2,3,3,1]. a is a value and b is the frequency of the value. I wanna delete the value that its frequency==1 and then the same residual value will be summed. I code something like this
d=[a;b]
for i = 1:length(d)
if (d(i,:) == 1)
d(i,:) = []
end
end
it doesn't work, ??? Index exceeds matrix dimensions. when the value is deleted should be like this [5,3,4,1,3,1,4 ; 4,5,3,6,2,3,3] and then the same residual value is summed should be [5,3,4,1 ; 4,7,6,9]. What shoud i do? Thanks in advance
댓글 수: 0
답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!