How to delete value array and sum the residual value?

조회 수: 1 (최근 30일)
tedy
tedy 2013년 4월 6일
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

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 4월 6일
편집: Azzi Abdelmalek 2013년 4월 6일

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by