MATLAB: Is there any way to put a small matrix diagonally into a larger one concatanationdiagonalmatrix ex: [1 2;3 4] Big matrix :[1 2 0 0 0 0; 3 4 0 0 0 0; 0 0 1 2 0 0 0 0 3 4 0 0] Best Answer A = [1 2; 3 4];B = zeros(4,6);B(1:2,1:2) = A;B(3:4,3:4) = A; Related SolutionsMATLAB: How to generate a identity matrix based on another matrix You can use blkdiag for this:>> A = [1 2 3; 2 3 4];>> B = num2cell(A,2);>> blkdiag(B{:})ans = 1 2 3 0 0 0 0 0 0 2 3 4This is not an identity matrix though. MATLAB: Change entry of sparse matrix Change it exactly like regular (non-sparse) matrix:A(sub2ind(size(A), inx, inx)) = out Related QuestionForming a block diagonal matrix of one certain matrixUsing kron to create a large matrixMaximizing efficiency in simple commandsHow to use blkdiag in 3D matrixHow can i solve this problem ? its easy but i dont know!Is there any built-in function to make a matrix having non-zero entries in reverse diagonal only
Best Answer