Prev: THE SAME PROBLEM
Next: argument of type "double" is incompatible with parameter of type "mxArray **"
From: Ulrik Nash on 4 May 2010 07:42 Hi Everyone, Ssuppose I have a matrix A as follows: A = 1 1 2 2 3 3 Now I wish to sum horzontally, to obtain B B = 2 4 6 How can I do this without needing to transpose A. Is it possible? Regards, Ulrik.
From: Pekka Kumpulainen on 4 May 2010 07:50
"Ulrik Nash" <uwn(a)sam.sdu.dk> wrote in message <hrp16c$a9o$1(a)fred.mathworks.com>... > Hi Everyone, > > Ssuppose I have a matrix A as follows: > > A = > > 1 1 > 2 2 > 3 3 > > Now I wish to sum horzontally, to obtain B > > B = 2 > 4 > 6 > > How can I do this without needing to transpose A. Is it possible? > > Regards, > > Ulrik. RTM doc sum B = sum(A,dim) sums along the dimension of A specified by scalar dim. |