How can I find the first row of a specific number in a matrix?

11 次查看(过去 30 天)
Hello Matlab Users,
  • I have a A matrix:
  • A=[2 4;2 10;2 15;5 14;6 7;6 15;8 16;8 10] and I want to see the first row where I meet let's say "6"(which is the 5th row).Could you help me in solving that problem,please?

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2014-3-26
idx=find(any(A==6,2),1)

更多回答(1 个)

Joseph Cheng
Joseph Cheng 2014-3-26
you can use the find() function and search for when the first column in A contains "6".
  1 个评论
Rengin
Rengin 2014-3-26
编辑:Rengin 2014-3-26
I don't know how to use it for that specific problem. Could you write me suitable codes for it,please?

请先登录,再进行评论。

类别

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

标签

Community Treasure Hunt

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

Start Hunting!

Translated by