Complete the code to access the element in the 2nd row and 3rd column of matrix A.
element = A([1], 3);
In MATLAB, the first index is the row number. To access the 2nd row, use 2.
Complete the code to extract the entire 3rd column from matrix B.
col3 = B(:, [1]);The colon ':' means all rows, and the column index is 3 to get the 3rd column.
Fix the error in the code to assign 10 to the element in the 1st row and 4th column of matrix C.
C([1], 4) = 10;
Matrix indices in MATLAB start at 1, so the 1st row is indexed by 1.
Fill both blanks to create a submatrix from matrix D containing rows 2 to 4 and columns 1 to 3.
submatrix = D([1], [2]);
Use '2:4' to select rows 2 to 4 and '1:3' to select columns 1 to 3.
Fill all three blanks to create a matrix E where each element is the sum of the row and column indices from matrix F.
E = zeros(3, 3); for [1] = 1:3 for [2] = 1:3 E([1], [2]) = [1] + [2]; end end
Use 'i' for the outer loop (rows), 'j' for the inner loop (columns), and index E(i, j) to assign the sum.
