Skip to content

Commit ae662dc

Browse files
committed
exception if dim==0 (scalar result) and array input
1 parent cd515ac commit ae662dc

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎spatialmath/base/argcheck.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,8 @@ def getunit(v: ArrayLike, unit: str = "rad", dim=None) -> Union[float, NDArray]:
571571
else:
572572
# scalar or iterable in, ndarray out
573573
# iterable passed in
574+
if dim == 0:
575+
raise ValueError("for dim==0 input must be a scalar")
574576
v = getvector(v, dim=dim)
575577
if unit == "rad":
576578
return v

0 commit comments

Comments
 (0)