26#if defined (HAVE_CONFIG_H)
49 error (
"%s: dimension vector DIMS must not be empty",
name);
56 if (ii == dimsv(i) && ii >= 0)
59 error (
"%s: dimension vector DIMS must contain integers",
name);
113 int nargin = args.length ();
122 for (
int j = 0; j < nargin - 1; j++)
124 if (! args(j+1).isnumeric ())
125 error (
"sub2ind: subscripts must be numeric");
129 idxa(j) = args(j+1).index_vector ();
131 if (j > 0 && args(j+1).dims () != args(1).dims ())
132 error (
"sub2ind: all subscripts must be of the same size");
134 catch (index_exception& ie)
136 ie.set_pos_if_unset (nargin-1, j+1);
138 std::string msg = ie.message ();
262 if (args.length () != 2)
274 catch (
const index_exception& ie)
276 error (
"ind2sub: invalid index %s", ie.what ());
octave::idx_vector sub2ind(const dim_vector &dv, const Array< octave::idx_vector > &idxa)
Array< octave::idx_vector > ind2sub(const dim_vector &dv, const octave::idx_vector &idx)
charNDArray max(char d, const charNDArray &m)
N Dimensional Array with copy-on-write semantics.
octave_idx_type numel(void) const
Number of elements in the array.
Vector representing the dimensions (size) of an Array.
void resize(int n, int fill_value=0)
OCTAVE_API dim_vector redim(int n) const
Force certain dimensionality, preserving numel ().
OCTINTERP_API RowVector row_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
OCTINTERP_API void print_usage(void)
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void error_with_id(const char *id, const char *fmt,...)
void error(const char *fmt,...)
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
static OCTAVE_NAMESPACE_BEGIN dim_vector get_dim_vector(const octave_value &val, const char *name)