How can I find the position vector associated to an indice with the find function?
2 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!