GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
dlmread.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2008-2018 Jonathan Stickel
4 Copyright (C) 2010 Jaroslav Hajek
5 
6 This file is part of Octave.
7 
8 Octave is free software: you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12 
13 Octave is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with Octave; see the file COPYING. If not, see
20 <https://www.gnu.org/licenses/>.
21 
22 */
23 
24 // Adapted from previous version of dlmread.occ as authored by Kai
25 // Habel, but core code has been completely re-written.
26 
27 #if defined (HAVE_CONFIG_H)
28 # include "config.h"
29 #endif
30 
31 #include <cctype>
32 #include <fstream>
33 #include <limits>
34 
35 #include "file-ops.h"
36 #include "lo-ieee.h"
37 
38 #include "defun.h"
39 #include "interpreter.h"
40 #include "oct-stream.h"
41 #include "error.h"
42 #include "ovl.h"
43 #include "utils.h"
44 
45 static const octave_idx_type idx_max =
47 
48 static const double idx_max_dbl = double (idx_max);
49 
50 static bool
52 {
53  bool stat = false;
54 
55  if (is.peek () == std::istream::traits_type::eof ())
56  stat = true;
57  else
58  {
59  if (::isalpha (is.peek ()))
60  {
61  col = 0;
62  while (is && ::isalpha (is.peek ()))
63  {
64  char ch = is.get ();
65  col *= 26;
66  if (ch >= 'a')
67  col += ch - 'a' + 1;
68  else
69  col += ch - 'A' + 1;
70  }
71  col--;
72 
73  if (is)
74  {
75  is >> row;
76  row--;
77  if (is)
78  stat = true;
79  }
80  }
81  }
82 
83  return stat;
84 }
85 
86 static bool
87 parse_range_spec (const octave_value& range_spec,
90 {
91  bool stat = true;
92 
93  if (range_spec.is_string ())
94  {
95  std::istringstream is (range_spec.string_value ());
96  char ch = is.peek ();
97 
98  if (ch == '.' || ch == ':')
99  {
100  rlo = 0;
101  clo = 0;
102  ch = is.get ();
103  if (ch == '.')
104  {
105  ch = is.get ();
106  if (ch != '.')
107  stat = false;
108  }
109  }
110  else
111  {
112  stat = read_cell_spec (is, rlo, clo);
113 
114  if (stat)
115  {
116  ch = is.peek ();
117 
118  if (ch == '.' || ch == ':')
119  {
120  ch = is.get ();
121  if (ch == '.')
122  {
123  ch = is.get ();
124  if (! is || ch != '.')
125  stat = false;
126  }
127 
128  rup = idx_max;
129  cup = idx_max;
130  }
131  else
132  {
133  rup = rlo;
134  cup = clo;
135  if (! is || ! is.eof ())
136  stat = false;
137  }
138  }
139  }
140 
141  if (stat && is && ! is.eof ())
142  stat = read_cell_spec (is, rup, cup);
143 
144  if (! is || ! is.eof ())
145  stat = false;
146  }
147  else if (range_spec.is_real_matrix () && range_spec.numel () == 4)
148  {
149  ColumnVector range (range_spec.vector_value ());
150  // double --> unsigned int avoiding any overflow
151  rlo = static_cast<octave_idx_type> (std::min (range(0), idx_max_dbl));
152  clo = static_cast<octave_idx_type> (std::min (range(1), idx_max_dbl));
153  rup = static_cast<octave_idx_type> (std::min (range(2), idx_max_dbl));
154  cup = static_cast<octave_idx_type> (std::min (range(3), idx_max_dbl));
155  }
156  else
157  stat = false;
158 
159  return stat;
160 }
161 
162 DEFMETHOD (dlmread, interp, args, ,
163  doc: /* -*- texinfo -*-
164 @deftypefn {} {@var{data} =} dlmread (@var{file})
165 @deftypefnx {} {@var{data} =} dlmread (@var{file}, @var{sep})
166 @deftypefnx {} {@var{data} =} dlmread (@var{file}, @var{sep}, @var{r0}, @var{c0})
167 @deftypefnx {} {@var{data} =} dlmread (@var{file}, @var{sep}, @var{range})
168 @deftypefnx {} {@var{data} =} dlmread (@dots{}, "emptyvalue", @var{EMPTYVAL})
169 Read numeric data from the text file @var{file} which uses the delimiter
170 @var{sep} between data values.
171 
172 If @var{sep} is not defined the separator between fields is determined from
173 the file itself.
174 
175 The optional scalar arguments @var{r0} and @var{c0} define the starting row
176 and column of the data to be read. These values are indexed from zero,
177 i.e., the first data row corresponds to an index of zero.
178 
179 The @var{range} parameter specifies exactly which data elements are read.
180 The first form of the parameter is a 4-element vector containing the upper
181 left and lower right corners @code{[@var{R0},@var{C0},@var{R1},@var{C1}]}
182 where the indices are zero-based. Alternatively, a spreadsheet style
183 form such as @qcode{"A2..Q15"} or @qcode{"T1:AA5"} can be used. The
184 lowest alphabetical index @qcode{'A'} refers to the first column. The
185 lowest row index is 1.
186 
187 @var{file} should be a filename or a file id given by @code{fopen}. In the
188 latter case, the file is read until end of file is reached.
189 
190 The @qcode{"emptyvalue"} option may be used to specify the value used to
191 fill empty fields. The default is zero. Note that any non-numeric values,
192 such as text, are also replaced by the @qcode{"emptyvalue"}.
193 @seealso{csvread, textscan, textread, dlmwrite}
194 @end deftypefn */)
195 {
196  int nargin = args.length ();
197 
198  double empty_value = 0.0;
199 
200  if (nargin > 2 && args(nargin-2).is_string ()
201  && args(nargin-2).string_value () == "emptyvalue")
202  {
203  empty_value = args(nargin-1).double_value ();
204 
205  nargin -= 2;
206  }
207 
209  print_usage ();
210 
211  std::istream *input = nullptr;
212  std::ifstream input_file;
213 
214  if (args(0).is_string ())
215  {
216  // Filename.
217  std::string fname (args(0).string_value ());
218 
220 
221  tname = find_data_file_in_load_path ("dlmread", tname);
222 
223  input_file.open (tname.c_str (), std::ios::in);
224 
225  if (! input_file)
226  error ("dlmread: unable to open file '%s'", fname.c_str ());
227 
228  input = &input_file;
229  }
230  else if (args(0).is_scalar_type ())
231  {
232  octave::stream_list& streams = interp.get_stream_list ();
233 
234  octave::stream is = streams.lookup (args(0), "dlmread");
235 
236  input = is.input_stream ();
237 
238  if (! input)
239  error ("dlmread: stream FILE not open for input");
240  }
241  else
242  error ("dlmread: FILE argument must be a string or file id");
243 
244  // Set default separator.
245  std::string sep;
246  if (nargin > 1)
247  {
248  if (args(1).is_sq_string ())
249  sep = do_string_escapes (args(1).string_value ());
250  else
251  sep = args(1).string_value ();
252  }
253 
254  // Take a subset if a range was given.
255  octave_idx_type r0 = 0;
256  octave_idx_type c0 = 0;
259  if (nargin > 2)
260  {
261  if (nargin == 3)
262  {
263  if (! parse_range_spec (args(2), r0, c0, r1, c1))
264  error ("dlmread: error parsing RANGE");
265  }
266  else if (nargin == 4)
267  {
268  r0 = args(2).idx_type_value ();
269  c0 = args(3).idx_type_value ();
270  }
271 
272  if (r0 < 0 || c0 < 0)
273  error ("dlmread: left & top must be positive");
274 
275  // Short-circuit and return if range is empty
276  if (r1 < r0 || c1 < c0)
277  return ovl (Matrix (0,0));
278  }
279 
280  octave_idx_type i = 0;
281  octave_idx_type j = 0;
282  octave_idx_type r = 1;
283  octave_idx_type c = 1;
284  // Start with a reasonable size to avoid constant resizing of matrix.
285  octave_idx_type rmax = 32;
286  octave_idx_type cmax = 0;
287 
288  Matrix rdata (rmax, cmax, empty_value);
289  ComplexMatrix cdata;
290 
291  bool iscmplx = false;
292  bool sep_is_wspace = (sep.find_first_of (" \t") != std::string::npos);
293  bool auto_sep_is_wspace = false;
294 
296 
297  // Skip the r0 leading lines
298  octave_idx_type rcnt = r0;
299  while (rcnt > 0 && getline (*input, line))
300  rcnt--;
301 
302  if (rcnt > 0)
303  return ovl (Matrix (0,0)); // Not enough lines in file to satisfy RANGE
304  else
305  r1 -= r0;
306 
307  std::istringstream tmp_stream;
308 
309  // Read the data one field at a time, growing the data matrix as needed.
310  while (getline (*input, line))
311  {
312  // Skip blank lines for compatibility.
313  if ((! sep_is_wspace || auto_sep_is_wspace)
314  && line.find_first_not_of (" \t") == std::string::npos)
315  continue;
316 
317  // Infer separator from file if delimiter is blank.
318  if (sep.empty ())
319  {
320  // Skip leading whitespace.
321  size_t pos1 = line.find_first_not_of (" \t");
322 
323  // For Matlab compatibility, blank delimiter should
324  // correspond to whitespace (space and tab).
325  size_t n = line.find_first_of (",:; \t", pos1);
326  if (n == std::string::npos)
327  {
328  sep = " \t";
329  auto_sep_is_wspace = true;
330  }
331  else
332  {
333  char ch = line.at (n);
334 
335  switch (line.at (n))
336  {
337  case ' ':
338  case '\t':
339  sep = " \t";
340  auto_sep_is_wspace = true;
341  break;
342 
343  default:
344  sep = ch;
345  break;
346  }
347  }
348  }
349 
350  // Estimate the number of columns from first line of data.
351  if (cmax == 0)
352  {
353  size_t pos1, pos2;
354  if (auto_sep_is_wspace)
355  pos1 = line.find_first_not_of (" \t");
356  else
357  pos1 = 0;
358 
359  do
360  {
361  pos2 = line.find_first_of (sep, pos1);
362 
363  if (auto_sep_is_wspace && pos2 != std::string::npos)
364  {
365  // Treat consecutive separators as one.
366  pos2 = line.find_first_not_of (sep, pos2);
367  if (pos2 != std::string::npos)
368  pos2 -= 1;
369  }
370 
371  // Separator followed by EOL doesn't generate extra column
372  if (pos2 != std::string::npos)
373  cmax++;
374 
375  pos1 = pos2 + 1;
376  }
377  while (pos2 != std::string::npos);
378 
379  // FIXME: Should always be the case that iscmplx == false.
380  // Flag is initialized that way and no data has been read.
381  if (iscmplx)
382  cdata.resize (rmax, cmax, empty_value);
383  else
384  rdata.resize (rmax, cmax, empty_value);
385  }
386 
387  r = (r > i + 1 ? r : i + 1);
388  j = 0;
389 
390  size_t pos1, pos2;
391  if (auto_sep_is_wspace)
392  pos1 = line.find_first_not_of (" \t"); // Skip leading whitespace.
393  else
394  pos1 = 0;
395 
396  do
397  {
398  octave_quit ();
399 
400  pos2 = line.find_first_of (sep, pos1);
401  std::string str = line.substr (pos1, pos2 - pos1);
402 
403  if (auto_sep_is_wspace && pos2 != std::string::npos)
404  {
405  // Treat consecutive separators as one.
406  pos2 = line.find_first_not_of (sep, pos2);
407  if (pos2 != std::string::npos)
408  pos2 -= 1;
409  else
410  pos2 = line.length () - 1;
411  }
412 
413  // Separator followed by EOL doesn't generate extra column
414  if (pos2 == std::string::npos && str.empty ())
415  break;
416 
417  c = (c > j + 1 ? c : j + 1);
418  if (r > rmax || c > cmax)
419  {
420  // Use resize_and_fill for the case of unequal length rows.
421  // Keep rmax a power of 2.
422  rmax = std::max (2*(r-1), rmax);
423  cmax = std::max (c, cmax);
424  if (iscmplx)
425  cdata.resize (rmax, cmax, empty_value);
426  else
427  rdata.resize (rmax, cmax, empty_value);
428  }
429 
430  tmp_stream.str (str);
431  tmp_stream.clear ();
432 
433  double x = octave_read_double (tmp_stream);
434  if (tmp_stream)
435  {
436  if (tmp_stream.eof ())
437  {
438  if (iscmplx)
439  cdata(i,j++) = x;
440  else
441  rdata(i,j++) = x;
442  }
443  else
444  {
445  int next_char = std::tolower (tmp_stream.peek ());
446  if (next_char == 'i' || next_char == 'j')
447  {
448  // Process pure imaginary numbers.
449  if (! iscmplx)
450  {
451  iscmplx = true;
452  cdata = ComplexMatrix (rdata);
453  }
454 
455  cdata(i,j++) = Complex (0, x);
456  }
457  else
458  {
459  double y = octave_read_double (tmp_stream);
460 
461  if (! iscmplx && y != 0.)
462  {
463  iscmplx = true;
464  cdata = ComplexMatrix (rdata);
465  }
466 
467  if (iscmplx)
468  cdata(i,j++) = Complex (x, y);
469  else
470  rdata(i,j++) = x;
471  }
472  }
473  }
474  else if (iscmplx)
475  cdata(i,j++) = empty_value;
476  else
477  rdata(i,j++) = empty_value;
478 
479  pos1 = pos2 + 1;
480  }
481  while (pos2 != std::string::npos);
482 
483  if (i == r1)
484  break; // Stop early if the desired range has been read.
485 
486  i++;
487  }
488 
489  // Clip selection indices to actual size of data
490  if (r1 >= r)
491  r1 = r - 1;
492  if (c1 >= c)
493  c1 = c - 1;
494 
495  if (iscmplx)
496  {
497  if ((i == 0 && j == 0) || (c0 > c1))
498  return ovl (ComplexMatrix (0,0));
499 
500  cdata = cdata.extract (0, c0, r1, c1);
501  return ovl (cdata);
502  }
503  else
504  {
505  if ((i == 0 && j == 0) || (c0 > c1))
506  return ovl (Matrix (0,0));
507 
508  rdata = rdata.extract (0, c0, r1, c1);
509  return ovl (rdata);
510  }
511 }
512 
513 /*
514 %!test
515 %! file = tempname ();
516 %! unwind_protect
517 %! fid = fopen (file, "wt");
518 %! fwrite (fid, "1, 2, 3\n4, 5, 6\n7, 8, 9\n10, 11, 12");
519 %! fclose (fid);
520 %!
521 %! assert (dlmread (file), [1, 2, 3; 4, 5, 6; 7, 8, 9;10, 11, 12]);
522 %! assert (dlmread (file, ","), [1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12]);
523 %! assert (dlmread (file, ",", [1, 0, 2, 1]), [4, 5; 7, 8]);
524 %! assert (dlmread (file, ",", "B1..C2"), [2, 3; 5, 6]);
525 %! assert (dlmread (file, ",", "B1:C2"), [2, 3; 5, 6]);
526 %! assert (dlmread (file, ",", "..C2"), [1, 2, 3; 4, 5, 6]);
527 %! assert (dlmread (file, ",", 0, 1), [2, 3; 5, 6; 8, 9; 11, 12]);
528 %! assert (dlmread (file, ",", "B1.."), [2, 3; 5, 6; 8, 9; 11, 12]);
529 %! assert (dlmread (file, ",", 10, 0), []);
530 %! assert (dlmread (file, ",", 0, 10), []);
531 %! fail ('dlmread (file, ",", [0 1])', "error parsing RANGE");
532 %! unwind_protect_cleanup
533 %! unlink (file);
534 %! end_unwind_protect
535 
536 %!testif ; ! ismac ()
537 %! file = tempname ();
538 %! unwind_protect
539 %! fid = fopen (file, "wt");
540 %! fwrite (fid, "1, 2, 3\n4+4i, 5, 6\n7, 8, 9\n10, 11, 12");
541 %! fclose (fid);
542 %!
543 %! assert (dlmread (file), [1, 2, 3; 4 + 4i, 5, 6; 7, 8, 9; 10, 11, 12]);
544 %! assert (dlmread (file, ","), [1,2,3; 4 + 4i, 5, 6; 7, 8, 9; 10, 11, 12]);
545 %! assert (dlmread (file, ",", [1, 0, 2, 1]), [4 + 4i, 5; 7, 8]);
546 %! assert (dlmread (file, ",", "A2..B3"), [4 + 4i, 5; 7, 8]);
547 %! assert (dlmread (file, ",", "A2:B3"), [4 + 4i, 5; 7, 8]);
548 %! assert (dlmread (file, ",", "..B3"), [1, 2; 4 + 4i, 5; 7, 8]);
549 %! assert (dlmread (file, ",", 1, 0), [4 + 4i, 5, 6; 7, 8, 9; 10, 11, 12]);
550 %! assert (dlmread (file, ",", "A2.."), [4 + 4i, 5, 6; 7, 8, 9; 10, 11, 12]);
551 %! assert (dlmread (file, ",", 10, 0), []);
552 %! assert (dlmread (file, ",", 0, 10), []);
553 %! unwind_protect_cleanup
554 %! unlink (file);
555 %! end_unwind_protect
556 
557 %!xtest <47413>
558 %! ## Same test code as above, but intended only for test statistics on Mac.
559 %! if (! ismac ()), return; endif
560 %! file = tempname ();
561 %! unwind_protect
562 %! fid = fopen (file, "wt");
563 %! fwrite (fid, "1, 2, 3\n4+4i, 5, 6\n7, 8, 9\n10, 11, 12");
564 %! fclose (fid);
565 %!
566 %! assert (dlmread (file), [1, 2, 3; 4 + 4i, 5, 6; 7, 8, 9; 10, 11, 12]);
567 %! assert (dlmread (file, ","), [1,2,3; 4 + 4i, 5, 6; 7, 8, 9; 10, 11, 12]);
568 %! assert (dlmread (file, ",", [1, 0, 2, 1]), [4 + 4i, 5; 7, 8]);
569 %! assert (dlmread (file, ",", "A2..B3"), [4 + 4i, 5; 7, 8]);
570 %! assert (dlmread (file, ",", "A2:B3"), [4 + 4i, 5; 7, 8]);
571 %! assert (dlmread (file, ",", "..B3"), [1, 2; 4 + 4i, 5; 7, 8]);
572 %! assert (dlmread (file, ",", 1, 0), [4 + 4i, 5, 6; 7, 8, 9; 10, 11, 12]);
573 %! assert (dlmread (file, ",", "A2.."), [4 + 4i, 5, 6; 7, 8, 9; 10, 11, 12]);
574 %! assert (dlmread (file, ",", 10, 0), []);
575 %! assert (dlmread (file, ",", 0, 10), []);
576 %! unwind_protect_cleanup
577 %! unlink (file);
578 %! end_unwind_protect
579 
580 %!test <*42025>
581 %! file = tempname ();
582 %! unwind_protect
583 %! fid = fopen (file, "wt");
584 %! fwrite (fid, " \n 1 2\n11 22\n ");
585 %! fclose (fid);
586 %!
587 %! assert (dlmread (file), [1, 2; 11, 22]);
588 %! assert (dlmread (file, " "), [ 0, 0, 0, 0
589 %! 0, 1, 2, 0
590 %! 11, 22, 0, 0
591 %! 0, 0, 0, 0]);
592 %! unwind_protect_cleanup
593 %! unlink (file);
594 %! end_unwind_protect
595 
596 %!testif ; ! ismac () <*50589>
597 %! file = tempname ();
598 %! unwind_protect
599 %! fid = fopen (file, "wt");
600 %! fwrite (fid, "1;2;3\n");
601 %! fwrite (fid, "1i;2I;3j;4J\n");
602 %! fwrite (fid, "4;5;6\n");
603 %! fwrite (fid, "-4i;+5I;-6j;+7J\n");
604 %! fclose (fid);
605 %!
606 %! assert (dlmread (file), [1, 2, 3, 0; 1i, 2i, 3i, 4i;
607 %! 4, 5, 6, 0; -4i, 5i, -6i, 7i]);
608 %! assert (dlmread (file, "", [0 0 0 3]), [1, 2, 3]);
609 %! assert (dlmread (file, "", [1 0 1 3]), [1i, 2i, 3i, 4i]);
610 %! unwind_protect_cleanup
611 %! unlink (file);
612 %! end_unwind_protect
613 
614 %!xtest <47413>
615 %! ## Same test code as above, but intended only for test statistics on Mac.
616 %! if (! ismac ()), return; endif
617 %! file = tempname ();
618 %! unwind_protect
619 %! fid = fopen (file, "wt");
620 %! fwrite (fid, "1;2;3\n");
621 %! fwrite (fid, "1i;2I;3j;4J\n");
622 %! fwrite (fid, "4;5;6\n");
623 %! fwrite (fid, "-4i;+5I;-6j;+7J\n");
624 %! fclose (fid);
625 %!
626 %! assert (dlmread (file), [1, 2, 3, 0; 1i, 2i, 3i, 4i;
627 %! 4, 5, 6, 0; -4i, 5i, -6i, 7i]);
628 %! assert (dlmread (file, "", [0 0 0 3]), [1, 2, 3]);
629 %! assert (dlmread (file, "", [1 0 1 3]), [1i, 2i, 3i, 4i]);
630 %! unwind_protect_cleanup
631 %! unlink (file);
632 %! end_unwind_protect
633 
634 */
#define DEFMETHOD(name, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method.
Definition: defun.h:135
double octave_read_double(std::istream &is)
Definition: lo-utils.h:104
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)
Definition: dlmread.cc:87
Array< double > vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
fname
Definition: load-save.cc:767
std::string string_value(bool force=false) const
Definition: ov.h:955
void resize(octave_idx_type nr, octave_idx_type nc, double rfv=0)
Definition: dMatrix.h:148
OCTINTERP_API void print_usage(void)
Definition: defun.cc:54
static const double idx_max_dbl
Definition: dlmread.cc:48
bool is_real_matrix(void) const
Definition: ov.h:553
std::string tilde_expand(const std::string &name)
Definition: file-ops.cc:276
octave::stream_list & streams
Definition: file-io.cc:596
void error(const char *fmt,...)
Definition: error.cc:578
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
Definition: file-io.cc:587
stream lookup(int fid, const std::string &who="") const
Definition: oct-stream.cc:7351
octave_idx_type numel(const octave_value_list &idx)
Definition: ov.h:412
std::string str
Definition: hash.cc:118
static const octave_idx_type idx_max
Definition: dlmread.cc:45
Definition: dMatrix.h:36
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 input
Definition: strfns.cc:81
Matrix extract(octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const
Definition: dMatrix.cc:396
charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:227
ComplexMatrix extract(octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const
Definition: CMatrix.cc:682
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))
Definition: CMatrix.h:187
subroutine stat(x, n, av, var, xmin, xmax)
Definition: tstgmn.for:112
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl(args(0).isinteger())
OCTINTERP_API std::string do_string_escapes(const std::string &s)
static bool read_cell_spec(std::istream &is, octave_idx_type &row, octave_idx_type &col)
Definition: dlmread.cc:51
the element is set to zero In other the statement xample y
Definition: data.cc:5264
args.length() nargin
Definition: file-io.cc:589
for i
Definition: data.cc:5264
bool is_string(void) const
Definition: ov.h:577
std::complex< double > Complex
Definition: oct-cmplx.h:31
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
write the output to stdout if nargout is
Definition: load-save.cc:1612
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
Definition: utils.cc:888
where the brackets indicate optional arguments and and character or cell array For character arrays the conversion is repeated for every row
Definition: str2double.cc:342
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 const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE * x
charNDArray min(char d, const charNDArray &m)
Definition: chNDArray.cc:204