dpb
Posts:
9,242
Registered:
6/7/07


Re: Comparing individual cells of matrix with another matrix
Posted:
Apr 8, 2013 6:51 PM


On 4/8/2013 5:47 PM, Avni wrote: > I have a matrix A which is a 20 by 40 and matrix B which is 20 by 55. I > am trying to divide each cell with matrix A with each cell in Matrix B > to create a new matrix C. However, I am not trying to use loops because > the program will take forever to run. I tried looking in to the bsxfun > function however, it says i need both matrixes to be the same dimensions > and I repmat does not really work. > Could someone please help provide some guidance wit this issue? Are > there any other functions that I could use that I over looked?
Well, what do you think should happen for the extra 15 columns of B that aren't in A?
C=A./B(1:size(A,1),1:size(A,2));
is one solution if size(A) is always < size(B); otherwise you would have to pick min() of both.


