FETCH LARGEST NUMBERS

I HAVE A SET OF 10 NUMBERS .
AND I WANT THE OUT PUT TO BE THE LARGEST THREE NUMBERS FROM THE ABOVE SET....... THANKS IN ADVANCE

 채택된 답변

Matt Fig
Matt Fig 2011년 3월 1일

2 개 추천

1. Take the capslock off.
2. Sort your array in descending order. Use the SORT function.
3. Take the first 3 numbers in the sorted array.

댓글 수: 2

Jijo Ninan
Jijo Ninan 2011년 3월 1일
thanks for the reply ....cool idea ... i cannot take the first three number out of the array.....
Jan
Jan 2011년 3월 1일
Well, Matlab can. What have you tried and where did which problems occur?
Matt Fig means: x = rand(1, 10); s = sort(x, 2, 'ascending'); largest3 = s(1:3)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by