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

4 views (last 30 days)
A LL on 15 Oct 2020
Edited: A LL on 15 Oct 2020
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 on 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
##### 1 CommentShowHide None
A LL on 15 Oct 2020
Great! Thanks!

### Categories

Find more on Multidimensional Arrays in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!