Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Comparing individual cells of matrix with another matrix
Replies: 6   Last Post: Apr 9, 2013 12:57 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
dpb

Posts: 8,250
Registered: 6/7/07
Re: Comparing individual cells of matrix with another matrix
Posted: Apr 8, 2013 6:51 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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.

--




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.