From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: movavg   Too many output arguments.
Date: Tue, 2 Oct 2012 03:51:07 +0000 (UTC)
Organization: HSBC
Lines: 40
Message-ID: <k4dobb$m2e$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1349149867 22606 (2 Oct 2012 03:51:07 GMT)
NNTP-Posting-Date: Tue, 2 Oct 2012 03:51:07 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2921053
Xref: comp.soft-sys.matlab:779661

Here is my code in its entirety:
data = xlsread('brent_1D.xlsx');

filename = 'SBUX.xls';
AllDates = xlsread(filename,'A1:A686')
Close = xlsread(filename,'B1:B686')
annualScaling = sqrt(250);
movavg(Close, 5, 20, 'e')
[Short, Long] = movavg(Close, 5, 20, 'e')

sharpes = nan(100,1);

for m = 1:100
    [~,~,~,sharpes(m)] = movavg(Close,5,20,'e');

[~,mxInd] = max(sharpes);

Everything works fine up until this line:
    [~,~,~,sharpes(m)] = movavg(Close,5,20,'e');

I get the following error when I run the code through the debugger:
1   sharpes = nan(100,1);
Error using movavg
Too many output arguments.

Error in Debugging (line 4)
    [~,~,~,sharpes(m)] = movavg(Close,5,20,'e');

I know the movavg function takes 4 arguments; I can’t tell what the problem is here.  The Editor Window seems somewhat helpful for debugging, but it’s not helping me in the case.

Does anyone have any idea what’s going on here?  Can someone please help me get this straightened out?  Basically, I’ll following the example here: