MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Learn moreOpportunities for recent engineering grads.
Apply TodayMATLAB Central > MATLAB Newsreader > Summing consecutively signed integers 

I'll start with an example: 
Subject: Summing consecutively signed integers From: Roger Stafford Date: 26 Nov, 2012 20:54:11 Message: 2 of 12 
"K" wrote in message <k90dmu$oq9$1@newscl01ah.mathworks.com>... 
> y = x; 
Subject: Summing consecutively signed integers From: dpb Date: 26 Nov, 2012 21:40:10 Message: 4 of 12 
On 11/26/2012 3:05 PM, K wrote: 
> Don't see any great shakes here other than brute forcewhich is why 
Subject: Summing consecutively signed integers From: Roger Stafford Date: 26 Nov, 2012 22:42:19 Message: 6 of 12 
"K" wrote in message <k90p6c$64m$1@newscl01ah.mathworks.com>... 
For those interested, here is my forloop solution. 
Subject: Summing consecutively signed integers From: Roger Stafford Date: 27 Nov, 2012 00:56:19 Message: 8 of 12 
"K" wrote in message <k90tqt$lpe$1@newscl01ah.mathworks.com>... 
Subject: Summing consecutively signed integers From: Roger Stafford Date: 27 Nov, 2012 04:19:15 Message: 9 of 12 
"K" wrote in message <k90tqt$lpe$1@newscl01ah.mathworks.com>... 
Subject: Summing consecutively signed integers From: K Date: 27 Nov, 2012 16:53:17 Message: 10 of 12 
> y = zeros(size(x)); % < Important! 
Subject: Summing consecutively signed integers From: K Date: 27 Nov, 2012 17:46:12 Message: 11 of 12 
> Notice positions 6 and 7, specifically. In your code, the addition is happening to the previous variable from the output, whereas in my code it's adding from the original input. I'm trying to figure out exactly what your code is doing so that I can adjust it. It's much more compact and nicelooking. 
Subject: Summing consecutively signed integers From: Roger Stafford Date: 29 Nov, 2012 02:50:23 Message: 12 of 12 
"K" wrote in message <k92u94$est$1@newscl01ah.mathworks.com>... 
No tags are associated with this thread.
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.