MATLAB Answers

Searching matrix which contain specific value?

4 views (last 30 days)
Bishwam Pattnaik
Bishwam Pattnaik on 17 Aug 2019
Commented: Bishwam Pattnaik on 17 Aug 2019
Hi, i got two matrices of same size? lets say i am searching for a particular value? how can i use a counter loop to Return 1 if that matrix contain that value and return 0 if that matrix doesn't not contain the value?

  1 Comment

Bishwam Pattnaik
Bishwam Pattnaik on 17 Aug 2019
Like for example, i got a matrix [1,2,3,4,5,6,7,8,9] and another matrix like [10,11,12,13, 14,15,16,17,18,19]. The question is if the any of this matrix contains values greter than 15 return 1 otherwise 0? how can i do it.

Sign in to comment.

Answers (1)

madhan ravi
madhan ravi on 17 Aug 2019
Edited: madhan ravi on 17 Aug 2019
any(matrix(:)==value) % 1 means true ,false otherwise

  0 Comments

Sign in to comment.

Sign in to answer this question.