How to detect ones and its location in a column
1 次查看(过去 30 天)
显示 更早的评论
I have matrix A,
A= [0 0 0 0 0 1 1 0 0 0]
How can I detect the ones in the vector and also its location in a column?
The result should be
location = [6 7]
0 个评论
采纳的回答
Andrei Bobrov
2018-11-19
编辑:Andrei Bobrov
2018-11-19
in your case (for vector):
location = find(A);
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 NaNs 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!