简体   繁体   English

matlab识别最小值和最大值的位置

[英]matlab identify position of min and max

I have a time series and have calculated the min, max and mean values.我有一个时间序列并计算了最小值、最大值和平均值。 However, I want to know at which year the min and max observations occurred.但是,我想知道最小和最大观测值发生在哪一年。 How is it possible to identify the ith position of the min and max values in the dataset?如何确定数据集中最小值和最大值的第 i 个位置?

You find it using find command.您可以使用find命令找到它。

for example:例如:

M = [1992, 3 ,5; 1997, 8 ,2; 2000, 2, 15]
[~,min_i] = min(M(:,2)) %return the row index of min vaule in the 2nd column.
year_of_min = M(min_i,1)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM