Complete the code to reshape the vector into a 2x3 matrix.
A = 1:6; B = reshape(A, [1]);
The reshape function changes the shape of the array. Here, we want a 2 rows and 3 columns matrix, so use [2, 3].
Complete the code to reshape matrix M into a column vector.
M = [1 2 3; 4 5 6]; V = reshape(M, [1]);
To reshape M into a column vector, it must have 6 rows and 1 column, so use [6, 1].
Fix the error in reshaping matrix X into a 3x3 matrix.
X = 1:8; Y = reshape(X, [1]);
The vector X has 8 elements, so it cannot be reshaped into a 3x3 matrix (which needs 9 elements). Using [1, 8] keeps it as a row vector.
Fill both blanks to reshape vector V into a 4x2 matrix and then back to a 2x4 matrix.
V = 1:8; M1 = reshape(V, [1]); M2 = reshape(M1, [2]);
First reshape V into 4 rows and 2 columns, then reshape M1 into 2 rows and 4 columns.
Fill all three blanks to create a 3D array from vector W and then reshape it back to a 2D matrix.
W = 1:12; A = reshape(W, [1], [2], [3]); B = reshape(A, [4, 3]);
The vector W has 12 elements. Reshape it into a 3D array with dimensions 2x3x2 (2*3*2=12). Then reshape back to a 4x3 matrix.