diff libinterp/corefcn/cellfun.cc @ 33395:a258493e726a

Backed out changeset c714266d9f0d
author Arun Giridhar <arungiridhar@gmail.com>
date Sat, 13 Apr 2024 14:28:48 -0400
parents c714266d9f0d
children 3e446791b7ef
line wrap: on
line diff
--- a/libinterp/corefcn/cellfun.cc	Sat Apr 13 14:23:04 2024 +0200
+++ b/libinterp/corefcn/cellfun.cc	Sat Apr 13 14:28:48 2024 -0400
@@ -1991,8 +1991,8 @@
 {
   Cell retval;
 
-  if ((nd != 1 && nd != 2) || a.ndims () != 2)
-    error ("do_mat2cell_2d: A must be two-dimensional, and ND must be 1 or 2");
+  panic_unless (nd == 1 || nd == 2);
+  panic_unless (a.ndims () == 2);
 
   if (mat2cell_mismatch (a.dims (), d, nd))
     return retval;
@@ -2049,8 +2049,7 @@
 {
   Cell retval;
 
-  if (nd < 1)
-    error ("do_mat2cell_nd: ND must be at least 1");
+  panic_unless (nd >= 1);
 
   if (mat2cell_mismatch (a.dims (), d, nd))
     return retval;
@@ -2133,8 +2132,7 @@
 {
   Cell retval;
 
-  if (nd < 1)
-    error ("do_mat2cell: ND must be at least 1");
+  panic_unless (nd >= 1);
 
   if (mat2cell_mismatch (a.dims (), d, nd))
     return retval;