MATLAB: Boolean help with arrays

booleanhomework

I need help with some boolean statements. How do i create a boolean statement with an array. So pretty much i created a 2 3×3 arrays and I need to create a boolean statement to :
A = 3X3 Array
B = 3×3 array
C = 2×3 array
D = 2×3 array
A single boolean (1 or 0), indicating whether or not A contains the number 7
• A single boolean (1 or 0), indicating whether or not D is ALL zeros •
A single boolean (1 or 0), indicating whether or not A and C are equal •
A single boolean (1 or 0), indicating whether or not A and B are equal

Best Answer

You have incorrect syntax. First a big hint: A(:) turns A into a column vector containing all of the elements in a column ordered manner. So you can operate on A(:) to see if any or all of its elements meets a condition. E.g.,
all( A(:) < 4 ) would test to see if all elements of A are less than 4
any( A(:) == 0 ) would test to see if any element of A is equal to 0
Etc.