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: Making a square matrix from two vector
Replies: 22   Last Post: Mar 19, 2013 12:37 AM

Advanced Search

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

Posts: 11
Registered: 6/13/11
Re: Making a square matrix from two vector
Posted: Mar 18, 2013 9:16 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <kf513a$26g$1@newscl01ah.mathworks.com>...
> To have a cleaner code than BSXFUN, one can use
> http://www.mathworks.com/matlabcentral/fileexchange/23821-bsxops
>

> >> bsxops(1)
> >> % Data

> a = [1 2 3 4];
> b = [1 2 4 5].';

> >> x = b.*a + a + b
>
> ans =
>
> 3 5 7 9
> 5 8 11 14
> 9 14 19 24
> 11 17 23 29
>
> % Bruno


Bruno--As mentioned above, I'm loving this submission.

A quick question/comment: I can't get "less than" to work

% This is OK
(1:10).' >= (1:10)

% but this errors
(1:10).' < (1:10)

Is this something deliberate? (i.e., did you figure users can just use ~(x >= y) and thus save on overloading )



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.