help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Plot function not working


From: Mike Miller
Subject: Re: Plot function not working
Date: Fri, 19 Aug 2016 10:32:02 -0700
User-agent: Mutt/1.6.2-neo (2016-07-23)

On Fri, Aug 19, 2016 at 13:07:07 -0400, Nicholas Jankowski wrote:
> On Fri, Aug 19, 2016 at 12:49 PM, Mike Miller <address@hidden> wrote:
> 
> > On Fri, Aug 19, 2016 at 12:36:46 -0400, Nicholas Jankowski wrote:
> > > On Fri, Aug 19, 2016 at 11:52 AM, Mike Miller <address@hidden>
> > wrote:
> > >
> > > second or third time that has popped up very recently. How much overhead
> > > would a 'potentially unintended shadowing' warning consume?
> >
> > Already exists:
> >
> >   warning: function ./length.m shadows a built-in function
> >
> > It appears every time the function is added to the load path (e.g. when
> > Octave starts, when changing directories, calling addpath, or pkg load).
> >
> >
> sorry should have been more specific... my guess is a variable named length
> was created. This happened to me the other day when I typo'd a call to cell
> and it created a variable named cell, and I thought every subsequent call
> to cell was broken.

That was not the error in this case though.

The errors are not particularly clear, but if you know that these are
common gotchas you can differentiate between them:

  >> length (z)
  error: 'x2' undefined near line 2 column 9
  error: called from length
      length at line 2 column 2

The OP's error message implies that "length" is being executed as an
m-file function or script because of the line/column messages.

OTOH, the problem you are talking about:

  >> length (z)
  error: A(I): index out of bounds; value 2 out of bound 1

This error message implies that "length" is interpreted as a variable
and Octave is attempting to do subscript indexing on it.

In the next release of Octave this error message becomes

  error: length(2): out of bound 1

which is a bit clearer.

> how much overhead would it impose by having it check variable names for
> shadowing? Or is that too much attempted handholding.

Yes I think so. Would you like to see a shadow warning every time a loop
variable is named "i" or "j"?

-- 
mike



reply via email to

[Prev in Thread] Current Thread [Next in Thread]