ibrahim (2021). Diversity (https://www.mathworks.com/matlabcentral/fileexchange/39129-diversity), MATLAB Central File Exchange. Retrieved .
When the script is started, it displays "Enter the number of Diversity" and expects an input. The range and type of valid inputs are not explained in the help text, such that the user has to examine the poorly documented code to see, what this number should represent at all.
Why do you measure the timings by TIC/TOC?
Instead of the loop, the command MAX() is much faster to determin the maximum.
Currently the purpose of the program is not clear.
Users beware! This is a script that destroys your current workspace.
To the author: you should write it as a function, allowing flexible inputs, with proper comments and a help section that explains the purpose of the function in detail.
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!