MATLAB: How to sort new vector of the result of sum smallest probability

arraymatricesmatrixvector

I have matrix A with 10 probabilities. Then, I get the smallest probability index which is 9 and 10
A=[0.7188 0.0625 0.0625 0.0469 0.0313 0.0156 0.0156 0.0156 0.0156 0.0156]
index = find(ismember(A,min(A)));
B = index(end-1:end); % sucessfully run
After that I need to add the two smallest probabilities and named as C1 and delete the two smallest probability.
C1= A(9) + A(8); %C1= 0.0312
Then I need to sort the probability again in descending order.
A=[0.7188 0.0625 0.0625 0.0469 0.0313 C1 0.0156 0.0156 0.0156 ]

Best Answer

sort(A,'descend') %at the end