Get the position of the max and min values of a variables

1 次查看(过去 30 天)
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
Stephen23 2022-2-2
[b,index] = maxk(lat1,5);
% ^^^^^ the second output is the index

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by