How to find row number

13 ビュー (過去 30 日間)
Abhishek Modi
Abhishek Modi 2011 年 3 月 23 日
編集済み: Walter Roberson 2015 年 9 月 25 日
i have about 25000 rows and 1 colum.somewhere is the highest value.i need to find in which row is the highest value.how can i find out? kindly helP!

回答 (3 件)

Davide Ferraro
Davide Ferraro 2011 年 3 月 23 日
The command MAX will do the work. The second output is exactly the index of the max value. http://www.mathworks.com/access/helpdesk/help/techdoc/ref/max.html

Jonathon
Jonathon 2011 年 3 月 23 日
I would use the 'max' function. Format it '[value index] = max(array)', where array represents the input data array, value stores the maximum value and index stores the row number at which the maximum value occurs. The index returned is the first row number in which the maximum value occurs.
I checked this using a 1x25000 array of random numbers.

Duncan
Duncan 2013 年 4 月 3 日
編集済み: Walter Roberson 2015 年 9 月 25 日
You have to make another loop like this.
p=1;
i=1;
for i=1:267
if T(p,:)<C
p=p+1;
end
i=i+1;
end
p

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by