Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
4x3マトリックスには12の数字があり、その中で上位5つの数字を見つける必要があります。例えば、
B=[11 13 21;10 8 5;3 2 6;7 18 6]
したがって、上位5つの最大数は
ans=[21;18;13;11;10]
どうすればそれを行うことができますか?
データを並べ替えます。
Bsorted = sort(B(:), 'descend');
そしてトップ5を選んでください:
Btop5 = Bsorted(1:5);