フィルターのクリア

How to know the number of colunma having the magnitude and the row number in a matrix.

1 回表示 (過去 30 日間)
Ricardo Gutierrez
Ricardo Gutierrez 2019 年 11 月 14 日
コメント済み: Ricardo Gutierrez 2019 年 11 月 15 日
Hello friends.
I have a matrix A where I know the row number and the magnitude, but I don't know the column where this magnitude is
A = [ 6 5 3 1 9
2 4 6 8 5
12 14 6 18 16]
The data I have is magnitude (6) and row number (2).
What should I do to have the code tell me that in column 3 there is number 6 in row 2?
Regards

回答 (1 件)

the cyclist
the cyclist 2019 年 11 月 14 日
編集済み: the cyclist 2019 年 11 月 14 日
A = [ 6 5 3 1 9
2 4 6 8 5
12 14 6 18 16]
row = 2;
val = 6;
find(A(row,:)==val)

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

製品


リリース

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by