[Top][All Lists]

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

[Octave-bug-tracker] [bug #65011] improve input handling for colormaps

From: Rik
Subject: [Octave-bug-tracker] [bug #65011] improve input handling for colormaps
Date: Mon, 11 Dec 2023 14:55:11 -0500 (EST)

Update of bug#65011 (group octave):

         Planned Release:                    None => 10.1.0 (current default)


Follow-up Comment #1:

I agree.  Octave should avoid Garbage In / Garbage Out calculations by
checking its inputs carefully.  In general, we do a better job than Matlab,
but there are a lot of m-files in the scripts/ directory and not everything
checks its inputs so carefully.

Of interest, I tried real numbers, arrays, and complex numbers with spring()
in Matlab and it produces an error, but not during input validation.  Rather,
it is during the running of the script and the message is rather opaque. 
Matlab does accept negative integers and returns an empty matrix.  I think we
need to preserve that compatibility.

Hence, I would change the documentation to say a scalar integer.  And I would
change the tests to check for

if (isscalar (n) && isreal (n) && n == fix (n))

As a bonus, the isreal(n) check will also weed out cell arrays or structs
which aren't valid input.  Those are accepted by Matlab, but then produce an
obtuse error.


Reply to this item at:


Message sent via Savannah

reply via email to

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