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: repmat, reshape, bsxfun
Replies: 12   Last Post: Jan 23, 2012 11:08 AM

Advanced Search

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

Posts: 13
Registered: 5/16/11
repmat, reshape, bsxfun
Posted: Jan 23, 2012 12:28 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"James Tursa" wrote in message <jfhog2$laf$1@newscl01ah.mathworks.com>...
> "Pag Max" wrote in message <jfca39$r4g$1@newscl01ah.mathworks.com>...
> > Is there a smarter or shorter way to do this than what I have done? (Of course withot loop!!). I am thinking there is something repetitive in my solution
> > c is tiled in third dimension as many times as elements in b and then each tile is scaled by corresponding element in b.
> >
> > c=[1 2 3;4 5 6];
> > b=[1 2 3 4 5];
> > a=bsxfun(@times,repmat(c,[1 1 numel(b)]),reshape(b,[1 1 numel(b)]));

>
> Why repmat the c matrix? E.g.,
>
> a=bsxfun(@times,c,reshape(b,[1 1 numel(b)]));
>
> TMW seems to be dropping posts, so I will risk repeating an earlier post. My MTIMESX can also do this calculation, but will likely only benefit if the array sizes are large. What are the actual array sizes you are working with?
>
> James Tursa


Thanks I get it. Yes this post appeared much after I submitted. So did not check any responses.
I understand repmat was a repeatation. Yes I am dealing with very large array sizes. Will like to know if MTIMESX can be a smarter solution.



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.