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)
Show older comments
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
John D'Errico
on 10 Sep 2015
Edited: John D'Errico
on 10 Sep 2015
Oh, come on. Make an effort. You learn by doing, not by being told the answer.
Answers (1)
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()
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!