Clear Filters
Clear Filters

How to sort new vector of the result of sum smallest probability?

1 view (last 30 days)
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 ]

Accepted Answer

madhan ravi
madhan ravi on 19 Nov 2018
sort(A,'descend') %at the end

More Answers (0)

Categories

Find more on Shifting and Sorting Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!