The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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 ]

Posts: 9,850
Registered: 6/7/07
Re: Subtract values in a matrix
Posted: Nov 17, 2012 11:37 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 11/17/2012 1:45 PM, Bob Choy wrote:
> dpb <> wrote in message <k88ofr$kd2$>...
>> On 11/17/2012 1:12 PM, Bob Ferreira wrote:
>> ...

>> > 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]
>> >
>> > I hope I made myself understood, if not, please ask away.

>> ...
>> No clue how you got the result from the description, sorry...
>> What term, specifically was subtracted from which and how did you get
>> it to produce the desired result? (Actually, the answer to this may
>> well provide you w/ the (or at least a) solution).


> Okay well, the values in the second line of the matrix becomes the
> result of the first value of that column, minus the value that was there
> before, and after that, all values in the first line become all zeros.
> So in the example, m = [0,0,0;(2-3),(2-3),(2-3);(2-4),(2-4),(2-4)]

I still don't see how the column comes into and it's not clear to me
which matrix is "the" matrix, sorry...

I can get your answer via

>> n=repmat([m(1,:)],size(m,1),1);
>> n-m

ans =
0 0 0
-1 -1 -1
-2 -2 -2

Whether that's actually the result you want or not, I've no klew...


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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.