MATLAB: Adding a column of zeros at the beginning? matrix Hi, if H=[1 2 5 4 1;3 4 3 4 1] , how can I add two columns zeros at the beginning of mateix H?? Because I have a huge matrix and I’m looking for a simple way to that. Thanks Best Answer Something like this?n=2;H(:,1+n:end+n)=H(:,1:end);H(:,1:n)=0 Related SolutionsMATLAB: Adding a column to a specific column of big matrix Hi Wael !1)H(:,3) = H1(:,1)This would replace all rows of column 3 of H with all rows of column 1 of H12)H1(:,3) = zeros % making the third column as zerosH1(3,:) = zeros % making the third row as zerosThese two commands will help you achieve making the dimension of matrix H1 3*3 by adding zeros MATLAB: How to add zeros column and row at the beginning of matrix new_A=zeros(size(B));new_A(2:end,2:end)=A; Related QuestionAdding numbers to specific matrix index.How to add zero at the very beginning of the column matrixHow to create a meshgrid padded with a triangle of zeros in the upper-right and lower-left cornersReplace the first row of the matrix with zeros.Repmat
Best Answer