How can I find the position vector associated to an indice with the find function?

5 ビュー (過去 30 日間)
A LL
A LL 2020 年 10 月 15 日
編集済み: A LL 2020 年 10 月 15 日
Hi,
I am looking to plot a black grid-cell for specific indices but I don't know how to do that.
I have a matrix A size 1440x721
For some specific indices that I have identified with the find function I want to make the corresponding grid-cell black. Let's say that my condition is B.
I have
indice = find(A<=B)
But indice is now a vector of size 76903X1 and I don't know at what grid-cell it corresponds.
Thanks

採用された回答

Mathieu NOE
Mathieu NOE 2020 年 10 月 15 日
A and B must be of same size - then find can return row and col indices
example :
A =
0.9501 0.8913 0.8214
0.2311 0.7621 0.4447
0.6068 0.4565 0.6154
0.4860 0.0185 0.7919
>> B = 0.7*ones(size(A))
B =
0.7000 0.7000 0.7000
0.7000 0.7000 0.7000
0.7000 0.7000 0.7000
0.7000 0.7000 0.7000
>> [ind_row,ind_col] = find(A<=B)
ind_row =
2
3
4
3
4
2
3
ind_col =
1
1
1
2
2
3
3

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeColor and Styling についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by