Path: news.mathworks.com!not-for-mail
From: "John D'Errico" <woodchips@rochester.rr.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Strange errors
Date: Fri, 26 Oct 2007 15:06:38 +0000 (UTC)
Organization: John D'Errico (1-3LEW5R)
Lines: 42
Message-ID: <ffsvpu$jgl$1@fred.mathworks.com>
References: <ffsuk8$331$1@fred.mathworks.com>
Reply-To: "John D'Errico" <woodchips@rochester.rr.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1193411198 19989 172.30.248.35 (26 Oct 2007 15:06:38 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 26 Oct 2007 15:06:38 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869215
Xref: news.mathworks.com comp.soft-sys.matlab:434791



"Matthew Sullivan" <nospam@nospam.no> wrote in message <ffsuk8$331
$1@fred.mathworks.com>...
> I've been running in to a strange MATLAB script problem that
> I don't quite understand.  The specific error I get is
> "Subscript indices must either be real positive integers or
> logicals."  The indices I use are real positive integers,
> though. When I copy and past the offending commend in to the
> MATLAB command line, it executes without issue. 
> 
> The most frustrating thing is that the errors are not
> repeatable.  If I clear memory and rerun, it sometimes will
> work.  Other times, it seems to stop elsewhere in the
> script, or at another point in the loop.  I've only recently
> run in to this issue, as well.  I can sometimes get the
> error running older code that I hadn't run in a long time
> and had no problems with when I ran it months ago.
> 
> I assume there's something wrong with my computer or the
> script I'm running.  As it appears somewhat randomly I am at
> a loss for fixing it.  For completeness, here is my most
> recent error message:
> 
> ?? Subscript indices must either be real positive integers
> or logicals.
> 
> Error in ==> track at 502
>                 ym = y(ymat(1:lenxn,1:lenxm));
> 
> Error in ==> deflect_stitch_2 at 103
>             trt = track(xyt', trackdist, params);
> 
> lenxn = trackdist = 25

The problem is not with lenxn and indexing into
ymat.

The problem is that ymat apparently does not
always contain pure integers. 

So your indexing into y is the problem.

John