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

2 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Mathieu NOE
Mathieu NOE el 15 de Oct. de 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

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by