How to find a spesific value in a matrix?

2 次查看(过去 30 天)
I have an obstacles = [3,3; 3,4; 3,5; 4,3] matrix and I want to search [3,3] matrix in obstacles matrix and if this coordinates matches ı want to get 1 otherwise ı want to get 0 value.

采纳的回答

Ameer Hamza
Ameer Hamza 2020-5-20
编辑:Ameer Hamza 2020-5-20
obstacles = [3,3; 3,4; 3,5; 4,3];
TF = ismember([3 3], obstacles, 'rows')
Result
>> TF
TF =
logical
1

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by