#include <cctype>
#include <fstream>
#include <limits>
#include "file-ops.h"
#include "lo-ieee.h"
#include "defun-dld.h"
#include "oct-stream.h"
#include "error.h"
#include "oct-obj.h"
#include "utils.h"
Go to the source code of this file.
Functions | |
DEFUN_DLD (dlmread, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{data} =} dlmread (@var{file})\n\ @deftypefnx {Loadable Function} {@var{data} =} dlmread (@var{file}, @var{sep})\n\ @deftypefnx {Loadable Function} {@var{data} =} dlmread (@var{file}, @var{sep}, @var{r0}, @var{c0})\n\ @deftypefnx {Loadable Function} {@var{data} =} dlmread (@var{file}, @var{sep}, @var{range})\n\ @deftypefnx {Loadable Function} {@var{data} =} dlmread (@dots{}, \"emptyvalue\", @var{EMPTYVAL})\n\ Read the matrix @var{data} from a text file. If not defined the separator\n\ between fields is determined from the file itself. Otherwise the\n\ separation character is defined by @var{sep}.\n\ \n\ Given two scalar arguments @var{r0} and @var{c0}, these define the starting\n\ row and column of the data to be read. These values are indexed from zero,\n\ such that the first row corresponds to an index of zero.\n\ \n\ The @var{range} parameter may be a 4-element vector containing the upper\n\ left and lower right corner @code{[@var{R0},@var{C0},@var{R1},@var{C1}]}\n\ where the lowest index value is zero. Alternatively, a spreadsheet style\n\ range such as 'A2..Q15' or 'T1:AA5' can be used. The lowest alphabetical\n\ index 'A' refers to the first column. The lowest row index is 1.\n\ \n\ @var{file} should be a file name or file id given by @code{fopen}. In the\n\ latter case, the file is read until end of file is reached.\n\ \n\ The \"emptyvalue\" option may be used to specify the value used to fill empty\n\ fields. The default is zero.\n\ @seealso{csvread, textscan, textread, dlmwrite}\n\ @end deftypefn") | |
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) |
static bool | read_cell_spec (std::istream &is, octave_idx_type &row, octave_idx_type &col) |
Variables | |
static const octave_idx_type | idx_max = std::numeric_limits<octave_idx_type>::max () |
DEFUN_DLD | ( | dlmread | , | |
args | ||||
) |
Definition at line 158 of file dlmread.cc.
References c1, do_string_escapes(), error(), error_state, Matrix::extract(), ComplexMatrix::extract(), octave_stream::input_stream(), octave_stream_list::lookup(), octave_read_double(), parse_range_spec(), print_usage(), r1, Matrix::resize(), ComplexMatrix::resize(), file_ops::tilde_expand(), and x.
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 | |||
) | [static] |
Definition at line 83 of file dlmread.cc.
References octave_value::is_real_matrix(), octave_value::is_string(), octave_value::numel(), read_cell_spec(), octave_value::string_value(), and octave_value::vector_value().
Referenced by DEFUN_DLD().
static bool read_cell_spec | ( | std::istream & | is, | |
octave_idx_type & | row, | |||
octave_idx_type & | col | |||
) | [static] |
Definition at line 47 of file dlmread.cc.
Referenced by parse_range_spec().
const octave_idx_type idx_max = std::numeric_limits<octave_idx_type>::max () [static] |
Definition at line 44 of file dlmread.cc.
Referenced by dim_vector::safe_numel().