25 #if defined (HAVE_CONFIG_H) 87 if (next_only && ch !=
'%' && ch !=
'#')
93 if (
c ==
'%' ||
c ==
'#')
95 std::ostringstream buf;
97 while (
is.get (
c) && (
c ==
' ' ||
c ==
'\t' ||
c ==
'%' ||
c ==
'#'))
103 while (
is.get (
c) && isalpha (
c))
107 bool match = (
tmp.substr (0,
strlen (keyword)) == keyword);
111 std::ostringstream
value;
112 while (
is.get (
c) && (
c ==
' ' ||
c ==
'\t' ||
c ==
':'))
134 if (
c ==
' ' ||
c ==
'\t')
235 #define SUBSTRING_COMPARE_EQ(s, pos, n, t) (s.substr (pos, n) == t) 248 error (
"load: empty name keyword or no data found in file '%s'",
254 if (! (
name ==
".nargin." ||
name ==
".nargout." 256 error (
"load: invalid identifier '%s' found in file '%s'",
264 error (
"load: failed to extract keyword specifying value type");
267 size_t pos = tag.rfind (
' ');
269 if (pos != std::string::npos)
273 typ = (global ? tag.substr (7) : tag);
290 error (
"load: trouble reading ascii file '%s'",
filename.c_str ());
314 os <<
"# name: " <<
name <<
"\n";
319 os <<
"# type: global " <<
val.type_name () <<
"\n";
321 os <<
"# type: " <<
val.type_name () <<
"\n";
326 long old_precision =
os.precision ();
327 os.precision (precision);
329 success =
val.save_ascii (
os);
337 os.precision (old_precision);
339 return (
os && success);
364 error (
"for now, I can only save real matrices in 3-D format");
366 os <<
"# 3-D data...\n" 367 <<
"# type: matrix\n" 368 <<
"# total rows: " << nr <<
"\n" 369 <<
"# total columns: " << nc <<
"\n";
371 long old_precision =
os.precision ();
378 warning (
"ignoring last %d columns", extras);
385 os <<
tmp.extract (0,
i, nr-1,
i+2);
397 os <<
tmp.extract (0,
i, nr-1,
i);
403 os.precision (old_precision);
405 return (
os && ! fail);
std::string read_until_newline(std::istream &is, bool keep_newline)
#define SET_INTERNAL_VARIABLE_WITH_LIMITS(NM, MINVAL, MAXVAL)
octave_value lookup_type(const std::string &nm)
bool save_text_data_for_plotting(std::ostream &os, const octave_value &t, const std::string &name)
identity matrix If supplied two scalar respectively For allows like xample val
bool is_real_matrix(void) const
void skip_until_newline(std::istream &is, bool keep_newline)
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void error(const char *fmt,...)
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
static int Vsave_precision
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
#define SUBSTRING_COMPARE_EQ(s, pos, n, t)
octave_value resize(const dim_vector &dv, bool fill=false) const
nd deftypefn *std::string name
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
type_info & __get_type_info__(const std::string &who)
bool valid_identifier(const char *s)
std::string extract_keyword(std::istream &is, const char *keyword, const bool next_only)
octave_idx_type columns(void) const
octave_idx_type rows(void) const
T::size_type strlen(const typename T::value_type *str)
void warning(const char *fmt,...)
charNDArray max(char d, const charNDArray &m)
bool load_ascii(std::istream &is)
std::string read_text_data(std::istream &is, const std::string &filename, bool &global, octave_value &tc, octave_idx_type count)
bool save_text_data(std::ostream &os, const octave_value &val_arg, const std::string &name, bool mark_global, int precision)
bool save_three_d(std::ostream &os, const octave_value &tc, bool parametric)
octave_idx_type length(void) const
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
nd group nd example For each display the value
Matrix matrix_value(bool frc_str_conv=false) const