MATLAB: Replacing components of a matrix MATLABmatricesmatrixmatrix manipulation how to generate a matrix that replaces all components of a previous matrix lying between 2.9 and 3.2, by -1? Best Answer %your matrix is MisBetween = (M >= 2.9) & (M <= 3.2);M(isBetween) = -1 Related SolutionsMATLAB: Matrix manipulation and components Is this what you're asking for?A(A>3.1)- Rob MATLAB: 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. Related QuestionFinding the diagonal vector from a square matrixPrinciple Component Analysis
Best Answer