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: Subtract values in a matrix
Replies: 6   Last Post: Nov 19, 2012 12:20 AM

Advanced Search

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

Posts: 3
Registered: 11/17/12
Re: Subtract values in a matrix
Posted: Nov 17, 2012 2:54 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Daniel Gebhardt <gebhardt@cs.tu-berlin.de> wrote in message <20121117203903.4fb7f708@buero3>...
> "Bob Ferreira" <migmick2000@hotmail.com> schrieb am Sat, 17 Nov 2012 19:12:14 +0000 (UTC):
>

> > I have a matrix which has "L" lines and "C" columns. I want to subtract each value in the matrix by the [...] first value in the [...] line [...]
>
> > Example: m = [2,2,2;3,3,3;4,4,4] the matrix given should be [0,0,0;-1,-1,-1;-2,-2,-2]
>
> Hi,
>
> even so it might not scale well, and eventually fail on large matrices due to memory, it should work:
>
> (diag(m(1,:))*ones(size(m))-m')'
>
>
> Daniel


Thanks for your answer but it isnt going to work since the matriz Im using isnt square, so you end up multiplying matrices with different number of lines



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.