What is the fastes way to find the maximum of a set of data?

It would be easy to use a for loop and compare element by element, but I dont think that is the best way to do it. Does matlab have a function for this? Or would it be better to write my own sorting algorithm

 채택된 답변

Image Analyst
Image Analyst 2013년 9월 4일

0 개 추천

Well, the max() function springs to mind. Did you look up max in the help? If you want the data sorted, there is a sort() function, believe it or not.

댓글 수: 1

Thanks for the quick reply. Looking back at my question I would rephrase it: "What exactly is the max() function doing?" I use it quite frequently. is it the fastest/most efficient way to find the max?

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

추가 답변 (0개)

카테고리

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

태그

질문:

2013년 9월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by