27 #if defined (HAVE_CONFIG_H)
52 if (is.peek () == std::istream::traits_type::eof ())
56 if (::isalpha (is.peek ()))
59 while (is && ::isalpha (is.peek ()))
95 if (ch ==
'.' || ch ==
':')
115 if (ch ==
'.' || ch ==
':')
121 if (!
is || ch !=
'.')
132 if (!
is || !
is.eof ())
138 if (stat &&
is && !
is.eof ())
141 if (!
is || !
is.eof ())
195 double empty_value = 0.0;
197 if (nargin > 2 &&
args(nargin-2).is_string ()
198 &&
args(nargin-2).string_value () ==
"emptyvalue")
200 empty_value =
args(nargin-1).double_value ();
205 if (nargin < 1 || nargin > 4)
208 std::istream *
input = 0;
209 std::ifstream input_file;
211 if (
args(0).is_string ())
220 input_file.open (tname.c_str (), std::ios::in);
223 error (
"dlmread: unable to open file '%s'", fname.c_str ());
227 else if (
args(0).is_scalar_type ())
234 error (
"dlmread: stream FILE not open for input");
237 error (
"dlmread: FILE argument must be a string or file id");
243 if (
args(1).is_sq_string ())
246 sep =
args(1).string_value ();
259 error (
"dlmread: error parsing RANGE");
261 else if (nargin == 4)
263 r0 =
args(2).idx_type_value ();
264 c0 =
args(3).idx_type_value ();
267 if (r0 < 0 || c0 < 0)
268 error (
"dlmread: left & top must be positive");
281 bool iscmplx =
false;
282 bool sepflag =
false;
288 getline (*input, line);
291 std::istringstream tmp_stream;
295 while (getline (*input, line))
298 if (line.find_first_not_of (
" \t") == std::string::npos)
305 size_t n = line.find_first_of (
",:; \t",
306 line.find_first_of (
"0123456789"));
307 if (n == std::string::npos)
314 char ch = line.at (n);
335 size_t pos1 = line.find_first_not_of (
" \t");
338 size_t pos2 = line.find_first_of (sep, pos1);
340 if (sepflag && pos2 != std::string::npos)
343 pos2 = line.find_first_not_of (sep, pos2);
344 if (pos2 != std::string::npos)
347 pos2 = line.length () - 1;
352 if (pos2 != std::string::npos)
355 pos1 = std::string::npos;
358 while (pos1 != std::string::npos);
361 cdata.
resize (rmax, cmax);
363 rdata.
resize (rmax, cmax);
366 r = (r > i + 1 ? r : i + 1);
369 size_t pos1 = line.find_first_not_of (
" \t");
374 size_t pos2 = line.find_first_of (sep, pos1);
377 if (sepflag && pos2 != std::string::npos)
379 pos2 = line.find_first_not_of (sep, pos2) - 1;
381 c = (c > j + 1 ? c : j + 1);
382 if (r > rmax || c > cmax)
389 cdata.
resize (rmax, cmax);
391 rdata.
resize (rmax, cmax);
394 tmp_stream.str (str);
400 if (tmp_stream.eof ())
407 else if (std::toupper (tmp_stream.peek ()) ==
'I')
419 if (! iscmplx && y != 0.)
432 cdata(i,j++) = empty_value;
434 rdata(i,j++) = empty_value;
436 if (pos2 != std::string::npos)
439 pos1 = std::string::npos;
442 while (pos1 != std::string::npos);
459 cdata = cdata.
extract (0, c0, r1, c1);
461 rdata = rdata.
extract (0, c0, r1, c1);
double octave_read_double(std::istream &is)
static bool parse_range_spec(const octave_value &range_spec, octave_idx_type &rlo, octave_idx_type &clo, octave_idx_type &rup, octave_idx_type &cup)
void resize(octave_idx_type nr, octave_idx_type nc, double rfv=0)
Matrix extract(octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl(args(0).is_integer_type())
OCTINTERP_API void print_usage(void)
friend class ComplexMatrix
#define DEFUN(name, args_name, nargout_name, doc)
void error(const char *fmt,...)
OCTAVE_EXPORT octave_value_list return the value of the option it must match the dimension of the state and the relative tolerance must also be a vector of the same length tem it must match the dimension of the state and the absolute tolerance must also be a vector of the same length The local error test applied at each integration step is xample roup calculate Y_a and Y _d item Given calculate Y nd enumerate In either initial values for the given components are input
std::istream * input_stream(void)
static std::string tilde_expand(const std::string &)
octave_idx_type numel(const octave_value_list &idx)
std::string string_value(bool force=false) const
nd deftypefn *octave_map m
bool is_string(void) const
static const octave_idx_type idx_max
static octave_stream lookup(int fid, const std::string &who="")
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
charNDArray max(char d, const charNDArray &m)
OCTINTERP_API std::string find_data_file_in_load_path(const std::string &fcn, const std::string &file, bool require_regular_file=false)
void resize(octave_idx_type nr, octave_idx_type nc, const Complex &rfv=Complex(0))
subroutine stat(x, n, av, var, xmin, xmax)
OCTINTERP_API std::string do_string_escapes(const std::string &s)
=val(i)}if ode{val(i)}occurs in table i
static bool read_cell_spec(std::istream &is, octave_idx_type &row, octave_idx_type &col)
Array< double > vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
the element is set to zero In other the statement xample y
std::complex< double > Complex
write the output to stdout if nargout is
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
ComplexMatrix extract(octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const
OCTAVE_EXPORT octave_value_list or cell arrays Arguments are concatenated vertically The returned values are padded with blanks as needed to make each row of the string array have the same length Empty input strings are significant and will concatenated in the output For numerical each element is converted to the corresponding ASCII character A range error results if an input is outside the ASCII range(0-255).For cell arrays
where the brackets indicate optional arguments and and character or cell array For character arrays the conversion is repeated for every row
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE * x
bool is_real_matrix(void) const