V1=[3 2 3 3 2 3 2 3 3 2];
V2=[5;6;5;5;5];
uV1 = unique(V1);
for i = 1:numel(uV1)
disp(sum(V1(V1 == uV1(i))));
end
uV2 = unique(V2);
for i = 1:numel(uV2)
disp(sum(V2(V2 == uV2(i))));
end
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!