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 Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by