[bug #68053] [mapping] unitratio() does not accept plural unit names (MATLAB compatibility)
GnuPooh <[email protected]>
| Newsgroups | gmane.comp.gnu.octave.bugs |
|---|---|
| Message-ID | <[email protected]> |
Please use the bug tracker to post updates to a bug report. The mailing list is intended as a read-only notification stream. Info posted to this mailing list address won't appear in the tracker database where it is most useful.
URL:
<https://savannah.gnu.org/bugs/?68053>
Summary: [mapping] unitratio() does not accept plural unit
names (MATLAB compatibility)
Group: GNU Octave
Submitter: gnupooh
Submitted: Mon 16 Feb 2026 10:52:48 PM UTC
Category: Octave Package
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Matlab Compatibility
Status: None
Assigned to: None
Originator Name: Rick Niles
Originator Email:
Open/Closed: Open
Discussion Lock: Unlocked
Release: other
Operating System: Any
Fixed Release: None
Planned Release: None
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Mon 16 Feb 2026 10:52:48 PM UTC By: GnuPooh <gnupooh>
Package Name | Version | Installation directory
--------------+---------+-------------------------
mapping | 1.4.3 | /usr/share/octave/packages/mapping-1.4.3
In the Octave Mapping package, unitsratio() only accepts singular unit names
such as "meter", but rejects plural forms like "meters".
MATLAB's unitsratio() accepts both singular and plural unit names.
This causes MATLAB-compatible code to fail in Octave.
Example:
Octave:
octave:8> unitsratio("meters","kilometers")
error: Unknown unit: meters
error: called from
unitsratio at line 36 column 5
octave:9> unitsratio("meter","kilometer")
ans = 1000
MATLAB accepts both forms.
This appears to be a compatibility bug and could possibly be fixed by
normalizing plural forms (e.g., stripping a trailing 's'). e.g.
a = regexprep(a, 's$', '');
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?68053>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
(application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCaZOfxAAKCRCqLAuaBUf3 TupjAQDfmziRLmHSbVeMkXkCIp9UTqadvp9hojr6JYWxjSoiawD+KWY/f36/waBn xXFS82ygIbOdIKm4o/ZWkr4vnsx+TwM= =0oyP -----END PGP SIGNATURE-----