26 #if defined (HAVE_CONFIG_H)
51 error (
"%s: dimension vector DIMS must not be empty", name);
58 if (ii == dimsv(i) && ii >= 0)
61 error (
"%s: dimension vector DIMS must contain integers", name);
115 int nargin = args.length ();
124 for (
int j = 0; j < nargin - 1; j++)
126 if (! args(j+1).isnumeric ())
127 error (
"sub2ind: subscripts must be numeric");
131 idxa(j) = args(j+1).index_vector ();
133 if (j > 0 && args(j+1).dims () != args(1).dims ())
134 error (
"sub2ind: all subscripts must be of the same size");
140 std::string msg = ie.message ();
260 if (args.length () != 2)
265 int nd = (nargout == 0) ? 1 : nargout;
271 std::swap (dv(0), dv(1));
278 retval(0) = retval(1);
282 error (
"ind2sub: invalid index %s", ie.what ());
template class OCTINTERP_CLASS_TEMPLATE_INSTANTIATION_API Array< octave_value >
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.
OCTARRAY_OVERRIDABLE_FUNC_API 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 ().
void set_pos_if_unset(octave_idx_type nd_arg, octave_idx_type dim_arg)
void set_var(const std::string &var_arg="")
virtual const char * err_id(void) const =0
OCTINTERP_API RowVector row_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
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 dim_vector get_dim_vector(const octave_value &val, const char *name)