main.m189 chars10 lines
In this code, we first create a matrix with elements from 1 to 100 using the syntax matrix = 1:100. We then use a nested for loop to iterate over each element in the matrix. Within each iteration, we calculate the index of the current element using the formula index = row + 10 * (column - 1). We use mod function to check if the element is divisible by 7. If the mod function returns a result of 0, indicating that the element is divisible by 7, disp function is used to display the element.
gistlibby LogSnag