Path: news.mathworks.com!not-for-mail
From: "Titus" <titus.edelhofer@mathworks.de>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Strange errors
Date: Fri, 26 Oct 2007 16:57:58 +0200
Organization: The MathWorks, Inc.
Lines: 51
Message-ID: <ffsv9n$c6l$1@fred.mathworks.com>
References: <ffsuk8$331$1@fred.mathworks.com>
NNTP-Posting-Host: de-edelhoft-x.ac.mathworks.de
X-Trace: fred.mathworks.com 1193410679 12501 172.16.75.150 (26 Oct 2007 14:57:59 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 26 Oct 2007 14:57:59 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3028
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028
Xref: news.mathworks.com comp.soft-sys.matlab:434790




"Matthew Sullivan" <nospam@nospam.no> schrieb im Newsbeitrag 
news: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
>
>
>

Hi Matthew,
are you sure, that ymat has only integer values? Sometimes it
might happen that they look like integers but they don't. You can
try by computing
ymat2 = ymat - round(ymat);
before line 502 and see, if ymat2 is really zero by
ymatIsInteger = ~any(ymat(:))

If they should be integers but are not (due to roundoff),
use round(ymat) instead of ymat.

Titus