Info

This question is closed. Reopen it to edit or answer.

Create a vector that has 10 float numbers distributed between 10 and 30, then find the second largest number in the vector.

1 view (last 30 days)
Display the number and its index. Assume the numbers are distinct. Use loops in your program. (Hint: find the largest number, replace it with 10, then …)
  3 Comments

Answers (1)

Walter Roberson
Walter Roberson on 10 Sep 2015
sort() the values. Return the second last of them. You can get the index from the second output of sort()

Community Treasure Hunt

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

Start Hunting!