MATLAB: I want to initialize a matrix of 3×3 to value -1 how this colud be done initialize matrix with -1 value M=zeros(3,3); intialize M with zeros of 3×3 but what to do if i want to initialize it with -1 i.e -1 -1 -1-1 -1 -1-1 -1 -1 can anybody help me Best Answer -ones(3,3) Related SolutionsMATLAB: How to replace elements of a matrix position wise???? A(:,3:4)=~A(:,3:4) MATLAB: Matrix[1,1,1,1;-1,-1,-1,-1;1,1,1,1] to vector[1,1,1,1,-1,-1,-1,-1,1,1,1,1] I believe you intended semicolons (;) instead of colons (:) in your matrix definition.To convert it to a vector, use the reshape function:Matrix = [1,1,1,1; -1,-1,-1,-1; 1,1,1,1];Vector = reshape(Matrix', 1, [])Vector = 1 1 1 1 -1 -1 -1 -1 1 1 1 1EDIT — Added output of ‘Vector’. Related QuestionString into 3×3 MatrixHow can I convert a binary matrix to a linear dataStrange 3×3 Lowpass filter
Best Answer