26 #if defined (HAVE_CONFIG_H)
48 error (
"%s: dimension vector DIMS must not be empty",
name);
55 if (ii == dimsv(i) && ii >= 0)
58 error (
"%s: dimension vector DIMS must contain integers",
name);
112 int nargin = args.length ();
121 for (
int j = 0; j < nargin - 1; j++)
123 if (! args(j+1).isnumeric ())
124 error (
"sub2ind: subscripts must be numeric");
128 idxa(j) = args(j+1).index_vector ();
130 if (j > 0 && args(j+1).dims () != args(1).dims ())
131 error (
"sub2ind: all subscripts must be of the same size");
137 std::string msg = e.message ();
261 if (args.length () != 2)
275 error (
"ind2sub: invalid index %s", e.what ());
template class OCTINTERP_API Array< octave_value >
Array< idx_vector > ind2sub(const dim_vector &dv, const idx_vector &idx)
idx_vector sub2ind(const dim_vector &dv, const Array< idx_vector > &idxa)
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)
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)
virtual const char * err_id(void) const =0
void set_var(const std::string &var_arg="")
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::octave_value(const Array< char > &chm, char type) return retval
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)