|
ImageAnalyst <imageanalyst@mailinator.com> wrote in message
<1193884363.080919.312120@22g2000hsm.googlegroups.com>...
> On Oct 26, 4:10 pm, "Matthew Sullivan" <nos...@nospam.no>
wrote:
> > ImageAnalyst <imageanal...@mailinator.com> wrote in message
> >
> > <1193413162.578228.104...@o3g2000hsb.googlegroups.com>...
> >
> >
> >
> >
> >
> > > On Oct 26, 10:46 am, "Matthew Sullivan" <nos...@nospam.no>
> > wrote:
> > > > 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
> >
> > >
============================================================
> > > Put a breakpoint there and check the workspace to see if
> > it calls ymat
> > > an array of integers or doubles.
> > > Also, you can do class(ymat) in the command window at that
> > breakpoint
> > > to see what MATLAB thinks it really is.
> > > It will report back the data type it considers it: some
> > flavor or
> > > floating point, or some flavor of integer.
> > > Good luck,
> > > ImageAnalyst
> >
> > Thanks for the suggestions, but I'm afraid I didn't do a
> > good job of detailing my problem. I am running data
> > analysis on a number of files in a loop. The command that
> > crashes is always a pair like this:
> >
> > negative = find(ydata < 0);
> > plot(xdata(negative), -ydata(negative), '.');
> >
> > for most of the iterations through the loop, it works fine,
> > but at some point it gives the above message. The confusing
> > things to me are:
> >
> > 1) it doesn't always stop at the same place in the loop
> > 2) it doesn't always happen, sometimes it works, sometimes
> > it doesn't
> > 3) if I look at the array negative, it is filled with
> > positive integers. max(negative-floor(negative)) = 0.
> > 4) if I simply copy the failed command from the command
> > window the command works without fail.
> >
> > My real question is: why does the same exact code not
> > always produce the same exact results?- Hide quoted text -
> >
> > - Show quoted text -
>
> ===========================================
> Matthew:
> Are you 100% sure that negative is NEVER null? Does it
still crash if
> you do something like:
> negative = find(ydata < 0);
> if ~isempty(negative)
> plot(xdata(negative), -ydata(negative), '.');
> end
> Regards,
> ImageAnalyst
>
I am 100% sure that negative is never null. When I look at
it, it is always a list of positive numbers. Furthermore,
when I just cut and past the last command it works without
problem.
I turned JIT off and I still get the randomly get these
errors. It has become so bad that I can't run scripts for >
20 files without always getting these errors.
|