Job Recruitment Website - Immigration policy - How to judge whether the elements in a matrix are not greater than the number in matlab?

How to judge whether the elements in a matrix are not greater than the number in matlab?

Given a number, how to judge whether the elements in a matrix are not greater than this number in matlab? Then a simple and feasible way is to find the largest element value in the matrix first, and then compare it with the given number to judge.

For example, given 1 1, the matrix a is as follows.

& gt& gta =[ 1 2 3; 3 2 5; 3 6 9]

A =

1 2 3

3 2 5

3 6 9

Find the maximum value of matrix a,

& gt& gt maximum value (a (:))

ans =

nine

Comparing 1 1 with the maximum value of 9, it is easy to see that 1 1 is greater than 9, so the elements in matrix A are not greater than 1 1.