MATLAB: How to write a matrix 6×1 that the element (2,1) and (6,1) equal to 1 and others are zero matrixprogramming of matrix like this : 0 1 0 0 0 1 Best Answer If the vector is ‘A’, this works:A([2 6]) = 1;produces:A = 0 1 0 0 0 1 Related SolutionsMATLAB: Creating a Matrix including ones on diagonal kron(eye(4),ones(1,5)) MATLAB: Matrix with gradually increasing! flip(tril(ones(5)))ans = 1 1 1 1 1 1 1 1 1 0 1 1 1 0 0 1 1 0 0 0 1 0 0 0 0 Related QuestionHow to do this matrixUnderstanding repmat(6,,(1:n*N),1)Remove elements from a matrix
Best Answer