MATLAB: Is there any way of doing this operation without a loop arraydivide I want to do following operarion between an array (A) and a vector (B): A(i,j)/B(i) Is there any way to do it without looping? rdivide requires both A and B to be the same size… Thank you! Best Answer Use bsxfun. Note that the non-singleton dimensions have to be the same, so you may have to transpose your matrix, but the result should be the same.Example:A = randi(10, 5, 4);B = randi(20, 5, 1);C = bsxfun(@rdivide, A, B); Related SolutionsMATLAB: How to code to normalize a matrix by dividing each index by the max abs value in the row A=[2 7;8 10]out=A/max(abs(A(:))) MATLAB: Dividing every element in a row from a 2×2 matrix by an element from same row from a 2×1 matrix C = bsxfun(@rdivide,A,B); Related QuestionDivide rows of A by first entry of rowHow to divide each row of a cell by maximum numberA simple matrix operationZscore a matrix with NaN
Best Answer