Path: news.mathworks.com!not-for-mail From: "Laurentiu Galan" <larryg003@yahoo.com> Newsgroups: comp.soft-sys.matlab Subject: Very quick question about if then statements and standard deviation? Date: Thu, 2 Dec 2010 02:13:04 +0000 (UTC) Organization: NYU School of Medicine Lines: 24 Message-ID: <id6vbg$pjp$1@fred.mathworks.com> Reply-To: "Laurentiu Galan" <larryg003@yahoo.com> NNTP-Posting-Host: webapp-05-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1291255984 26233 172.30.248.35 (2 Dec 2010 02:13:04 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Thu, 2 Dec 2010 02:13:04 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 2612905 Xref: news.mathworks.com comp.soft-sys.matlab:691764 I have a matrix matrix with a bunch of returns: How do I create a second matrix, that will calculate the standard deviations for a trailing numbers in groups of three? i.e. if the first two numbers will be 0 and the nth number will be the standard deviation of the corresponding number in matrix 1 and the preceding 2 numbers. I have the matrix: matrix: matrix2 -.0001 0 0.003 0 0.012 stdev of (-0.001, 0.003, 0.012) -.002 I want matrix2: stdev of (0.003, 0.012, -0.002 -.2 stdev of (0.012, -.002, -.2) . . . . . . 0.02 -.07 0.04 stdev of (0.02, -0.07, 0.04) I know it's a very trivial if then statement, but i am having some difficulty with it. Thank you so much Matlab Forums community!