selecting elements in the matrix

2 ビュー (過去 30 日間)
Mahi Nazir
Mahi Nazir 2013 年 10 月 24 日
回答済み: Jan 2013 年 10 月 24 日
Suppose I have a matrix A=[1 5 7; 2 4 3; 7 8 9] I want the indices and the values of all the elements >6 So I want the answer to be
Row col vector
1 3 7
3 1 7
3 2 8
3 3 9
When I use [row, col, v]= find(A>6) I get the correct indices for row and col but v gives me logical value 1 and not the actual element value. Kindly help

採用された回答

Jan
Jan 2013 年 10 月 24 日
Use
[row, col] = find(A>6)
to find row and column indeces and use
v = A( A>6 );
to get the corresponding values.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by