Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Erros with "For" loop nested in "While" loop
Date: Mon, 2 Jan 2012 01:22:08 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 16
Message-ID: <jdr0s0$6og$1@newscl01ah.mathworks.com>
References: <jdqvf0$2vd$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1325467328 6928 172.30.248.47 (2 Jan 2012 01:22:08 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 2 Jan 2012 01:22:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:753530

"Pathiraja " <chilovetck@yahoo.co.uk> wrote in message <jdqvf0$2vd$1@newscl01ah.mathworks.com>...
> ??? Subscript indices must either be real positive integers or logicals.
> Error in ==> BEMMT at 82
>             Thrust = sum(Dt)*rStep;
> .........
>         sum = 1;
> .........
>             Thrust = sum(Dt)*rStep;
- - - - - - - -
  Your difficulty is caused by using the name 'sum' for two purposes, a variable name and the matlab function with that name.  When you wrote

 Thrust = sum(Dt)*rStep;

matlab assumed you referred to the variable 'sum' rather than the 'sum' function and was then puzzled by the fact that Dt is not a valid index.  You should never use matlab's reserved function names to name your variables.

Roger Stafford