In: Computer Science
Using Matlab:
Using nested for loops (other methods are not allowed), write a function which takes as input a matrix, and as output returns true if at least one entry in the matrix is strictly greater than 8 and returns false otherwise.
Program:
Summary:
Program to return true if element in array is greater than 8 else false.
Step 1: function greater - takes array as parameter
Step 2: variable dimen takes the size of Array (row,column)
Step 3: Initialise output y as false so that we can change it to true when element is greater than 8
Step 4: Nested loop to iterate through each element in the array - dimen(1)=> row and dimen(2) =>column
Step5: If any element is greater than 8 then output is set to false
Step 6: display the output ( 1 Represents True)