MATLAB: Divide every entry of a column by the same number MATLABmatrix Suppose I have A = [1 2 3; 4 5 6; 7 8 9]; and I want to divide every entry in the second column by 2 so the answer is B = [1 1 3; 4 2.5 6; 7 4 9]; What will be a compact way of doing this? Best Answer A(:,2)=A(:,2)./2; B=A Related SolutionsMATLAB: How to sort vectors so every 1 entry is collected and followed by every 2 entry until the nth entry s = reshape([a;b;c;...;m],1,[]); MATLAB: Delete rows from matrix A=[ 1 2 3;... 4 5 6;... 7 8 9;... 10 11 12]b=2;A(b,:)=[] Related QuestionPrelocation of array entriesDivide all the elements of the column by the first entry
Best Answer