Question: Write a script that creates a 10 by 100 matrix using for loop. The structure of the matrix should be as follows: i) Each row
Write a script that creates a 10 by 100 matrix using for loop. The structure of the matrix should be as follows: i) Each row of the matrix should contain 10 ones and 90 zeros. ii) For the first row, first 10 elements must equal to one, rest of the row should be zero. For the second row, elements from 11th to the 20th column must equal to one, rest of the row should be zero, for the third row, elements from 21st to the 30th column must equal to one and goes like that.
Hint: Start with defining a 10 x 100 matrix where all elements of the matrix is zero. At each iteration of the for loop, change the desired 10 elements by equalizing them to 1.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
