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

1 vue (au cours des 30 derniers jours)
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

Réponse acceptée

Mathieu NOE
Mathieu NOE le 15 Oct 2020
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

Plus de réponses (0)

Catégories

En savoir plus sur Color and Styling dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by