changeset 31655:edd01ca92952

maint: merge stable to default
author Rik <rik@octave.org>
date Thu, 08 Dec 2022 20:35:15 -0800
parents 972dcc46bb41 (current diff) 33ce26ffc42b (diff)
children 085b65319e00
files liboctave/array/Array.h
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/array/Array.h	Thu Dec 08 15:23:29 2022 -0500
+++ b/liboctave/array/Array.h	Thu Dec 08 20:35:15 2022 -0800
@@ -54,7 +54,7 @@
 //!
 //! @code{.cc}
 //! // 3 D Array with 10 rows, 20 columns, and 5 pages, filled with 7.0
-//! Array<double> A Array<double (dim_vector (10, 20, 5), 7.0);
+//! Array<double> A (dim_vector (10, 20, 5), 7.0);
 //!
 //! // set value for row 0, column 10, and page 3
 //! A(0, 10, 3) = 2.5;
@@ -477,7 +477,7 @@
   //! Get the third dimension of the array (number of pages)
   //@{
   OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type dim3 (void) const
-  { return m_dimensions(2); }
+  { return m_dimensions.ndims () >= 3 ? m_dimensions(2) : 1; }
   OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type pages (void) const
   { return dim3 (); }
   //@}