Write a function largest () such that it can accept multiple numbers and return the largest item from the given list.
조회 수: 2(최근 30일)
표시 이전 댓글
Write a function largest () such that it can accept multiple numbers and return the largest item from the given list.
댓글 수: 3
답변(1개)
Jon
2022년 7월 27일
There is already a MATLAB function that "can accept multiple numbers and return the largest one"
x = [2,15,23.7,91.4,80.3] % vector with multiple numbers
xmax = max(x) % return the largest one
댓글 수: 2
dpb
2022년 7월 27일
Most homework assignments (as this must surely be) preclude the use of builtin functions to solve the problem as the pegagical exercise for the student...and, it's not clear the intent of this exercise is to consider a vector of multiple values as "multiple inputs" or not -- my reading is "not", but it doesn't say so unequivocally, granted.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!