How to find number in a matrix and output its row number?

조회 수: 6 (최근 30일)
shatha almarri
shatha almarri 2021년 2월 15일
답변: Walter Roberson 2021년 2월 15일
I have a coloumn vector
M = [83 82 86 84 85 90]
How can I find at which row the matrix has a value of 85 (should output row = 5 since 85 is on the 5th row)

채택된 답변

Walter Roberson
Walter Roberson 2021년 2월 15일
M = [83 82 86 84 85 90].'
M = 6×1
83 82 86 84 85 90
[row, column] = find(M == 85)
row = 5
column = 1

추가 답변 (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