Get the position of the max and min values of a variables
3 views (last 30 days)
Show older comments
Edited: Walter Roberson on 31 Jul 2022
Hi, so I want the position of the maximun values of a variable my code is:
pos = 1:numel(lat1);
b = maxk(lat1,5);
% index = pos(b);
When I use the line of code indez = pos(b) I get the following error:
Array indices must be positive integers or logical values.
I dont get why. Can somebody help me?
Stephen23 on 2 Feb 2022
[b,index] = maxk(lat1,5);
% ^^^^^ the second output is the index
More Answers (0)
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!