More New Functions: findfigs.m, isfloat.m, genvarname.m

John W. Eaton jwe at bevo.che.wisc.edu
Mon Mar 10 22:15:34 CDT 2008


On 10-Mar-2008, Bill Denney wrote:

| Attached are three new functions.  Essentially now I'm just going 
| through the list of functions in matlab that are missing in octave and 
| writing the low hanging fruit.

| # HG changeset patch
| # User bill at denney.ws
| # Date 1205199789 14400
| # Node ID a04d848ac6c371575205cbc130ed75035f2e9e4b
| # Parent  2e72daff62ba3d194850fff4e519d23a464c45e0
| genvarname.m, isfloat.m, findfigs.m: new functions

| +++ b/scripts/general/genvarname.m	Mon Mar 10 21:43:09 2008 -0400

Another genvarname was just submitted.  See

  https://www.cae.wisc.edu/pipermail/bug-octave/2008-March/005368.html

| +function b = isfloat (a)
| +
| +  b = isa (a, "double") || isa (a, "single");

I think this should probably be a built-in function, so I added it
that way instead.

| +function findfigs ()
| +
| +  figh = get (0, "children");
| +  screensize = get (0, "monitorpositions");

Octave doesn't have a root figure property "monitorpositions".  It
looks like the Matlab property is "monitorposition" so at least that
should be changed.  Should we add this function even though it can't
work until we add a functioning "monitorposition" property?

| +      if ((pos(1) > screensize(3)) |
| +          (pos(2) > screensize(4)) |
| +          (pos(1)+pos(3) < screensize(1)) |
| +          (pos(2)+pos(4) < screensize(2)))

If the comparisons here are scalars, then I think this should use ||
instead of |.  Also, there's no need for extra parens around the
operands here, even though they are expressions, and the usual
convention in Octave code is to put the operator first when the
expressionis broken over more than one line, like this:

  if (pos(1) > screensize(3)
      || pos(2) > screensize(4)
      || pos(1)+pos(3) < screensize(1)
      || pos(2)+pos(4) < screensize(2))

Will you and Robert please reconcile your versions and submit a single
function?

Also, when you add new .m files, they need to be listed in the
Makefile.in files where you add them.  It helps if that change is
included in your patch.

Thanks,

jwe


More information about the Octave-maintainers mailing list