GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
audioread.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2013-2018 Vytautas JanĨauskas
4 Copyright (C) 2016-2018 Damjan Angelovski
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 #if defined (HAVE_CONFIG_H)
25 # include "config.h"
26 #endif
27 
28 #include <algorithm>
29 #include <map>
30 #include <string>
31 
32 #include "dMatrix.h"
33 #include "dRowVector.h"
34 #include "file-ops.h"
35 #include "file-stat.h"
36 #include "oct-locbuf.h"
37 #include "unwind-prot.h"
38 
39 #include "defun-dld.h"
40 #include "error.h"
41 #include "errwarn.h"
42 #include "ov.h"
43 #include "ovl.h"
44 #include "pager.h"
45 
46 #if defined (HAVE_SNDFILE)
47 # include <sndfile.h>
48 #endif
49 
50 #if defined (HAVE_SNDFILE)
51 static void
52 safe_close (SNDFILE *file)
53 {
54  sf_close (file);
55 }
56 #endif
57 
58 DEFUN_DLD (audioread, args, ,
59  doc: /* -*- texinfo -*-
60 @deftypefn {} {[@var{y}, @var{fs}] =} audioread (@var{filename})
61 @deftypefnx {} {[@var{y}, @var{fs}] =} audioread (@var{filename}, @var{samples})
62 
63 @deftypefnx {} {[@var{y}, @var{fs}] =} audioread (@var{filename}, @var{datatype})
64 @deftypefnx {} {[@var{y}, @var{fs}] =} audioread (@var{filename}, @var{samples}, @var{datatype})
65 Read the audio file @var{filename} and return the audio data @var{y} and
66 sampling rate @var{fs}.
67 
68 The audio data is stored as matrix with rows corresponding to audio frames
69 and columns corresponding to channels.
70 
71 The optional two-element vector argument @var{samples} specifies starting
72 and ending frames.
73 
74 The optional argument @var{datatype} specifies the datatype to return.
75 If it is @qcode{"native"}, then the type of data depends on how the data
76 is stored in the audio file.
77 @seealso{audiowrite, audioformats, audioinfo}
78 @end deftypefn */)
79 {
80 #if defined (HAVE_SNDFILE)
81 
82  int nargin = args.length ();
83 
85  print_usage ();
86 
87  std::string filename = args(0).xstring_value ("audioread: FILENAME must be a string");
88 
89  SF_INFO info;
90  info.format = 0;
91  SNDFILE *file = sf_open (filename.c_str (), SFM_READ, &info);
92 
93  if (! file)
94  error ("audioread: failed to open input file '%s': %s",
95  filename.c_str (), sf_strerror (file));
96 
98 
99  frame.add_fcn (safe_close, file);
100 
101  OCTAVE_LOCAL_BUFFER (float, data, info.frames * info.channels);
102 
103  sf_read_float (file, data, info.frames * info.channels);
104 
105  sf_count_t start = 0;
106  sf_count_t end = info.frames;
107 
108  if ((nargin == 2 && ! args(1).is_string ()) || nargin == 3)
109  {
110  RowVector range = args(1).row_vector_value ();
111 
112  if (range.numel () != 2)
113  error ("audioread: invalid specification for range of frames");
114 
115  double dstart = (octave::math::isinf (range(0)) ? info.frames : range(0));
116  double dend = (octave::math::isinf (range(1)) ? info.frames : range(1));
117 
118  if (dstart < 1 || dstart > dend || dend > info.frames
119  || octave::math::x_nint (dstart) != dstart
120  || octave::math::x_nint (dend) != dend)
121  error ("audioread: invalid specification for range of frames");
122 
123  start = dstart - 1;
124  end = dend;
125  }
126 
127  sf_count_t items = end - start;
128 
129  Matrix audio (items, info.channels);
130 
131  double *paudio = audio.fortran_vec ();
132 
133  data += start * info.channels;
134 
135  for (int i = 0; i < items; i++)
136  {
137  for (int channel = 0; channel < info.channels; channel++)
138  paudio[items*channel+i] = *data++;
139  }
140 
141  octave_value ret_audio;
142 
143  if ((nargin == 2 && args(1).is_string ()) || nargin == 3)
144  {
146  if (nargin == 3)
147  type = args(2).string_value ();
148  else
149  type = args(1).string_value ();
150 
151  if (type == "native")
152  {
153  switch (info.format & SF_FORMAT_SUBMASK)
154  {
155  case SF_FORMAT_PCM_S8:
156  ret_audio = int8NDArray (audio * 127);
157  break;
158  case SF_FORMAT_PCM_U8:
159  ret_audio = uint8NDArray (audio * 127 + 127);
160  break;
161  case SF_FORMAT_PCM_16:
162  ret_audio = int16NDArray (audio * 32767);
163  break;
164  case SF_FORMAT_PCM_24:
165  ret_audio = int32NDArray (audio * 8388608);
166  break;
167  case SF_FORMAT_PCM_32:
168  ret_audio = int32NDArray (audio * 2147483648);
169  break;
170  default:
171  ret_audio = audio;
172  break;
173  }
174  }
175  else
176  ret_audio = audio;
177  }
178  else
179  ret_audio = audio;
180 
181  return ovl (ret_audio, info.samplerate);
182 
183 #else
184 
185  octave_unused_parameter (args);
186 
187  err_disabled_feature ("audioread",
188  "reading and writing sound files through libsndfile");
189 
190 #endif
191 }
192 
193 #if defined (HAVE_SNDFILE)
194 
195 static int
196 extension_to_format (const std::string& ext)
197 {
198  static bool initialized = false;
199 
200  static std::map<std::string, int> table;
201 
202  if (! initialized)
203  {
204  table["wav"] = SF_FORMAT_WAV;
205  table["aiff"] = SF_FORMAT_AIFF;
206  table["au"] = SF_FORMAT_AU;
207  table["raw"] = SF_FORMAT_RAW;
208  table["paf"] = SF_FORMAT_PAF;
209  table["svx"] = SF_FORMAT_SVX;
210  table["nist"] = SF_FORMAT_NIST;
211  table["voc"] = SF_FORMAT_VOC;
212  table["ircam"] = SF_FORMAT_IRCAM;
213  table["w64"] = SF_FORMAT_W64;
214  table["mat4"] = SF_FORMAT_MAT4;
215  table["mat5"] = SF_FORMAT_MAT5;
216  table["pvf"] = SF_FORMAT_PVF;
217  table["xi"] = SF_FORMAT_XI;
218  table["htk"] = SF_FORMAT_HTK;
219  table["sds"] = SF_FORMAT_SDS;
220  table["avr"] = SF_FORMAT_AVR;
221  table["wavex"] = SF_FORMAT_WAVEX;
222  table["sd2"] = SF_FORMAT_SD2;
223  table["flac"] = SF_FORMAT_FLAC;
224  table["caf"] = SF_FORMAT_CAF;
225  table["wve"] = SF_FORMAT_WVE;
226  table["ogg"] = SF_FORMAT_OGG;
227  table["mpc2k"] = SF_FORMAT_MPC2K;
228  table["rf64"] = SF_FORMAT_RF64;
229 
230  initialized = true;
231  }
232 
233  std::map<std::string, int>::const_iterator it = table.find (ext);
234 
235  return (it != table.end ()) ? it->second : 0;
236 }
237 
238 #endif
239 
240 DEFUN_DLD (audiowrite, args, ,
241  doc: /* -*- texinfo -*-
242 @deftypefn {} {} audiowrite (@var{filename}, @var{y}, @var{fs})
243 @deftypefnx {} {} audiowrite (@var{filename}, @var{y}, @var{fs}, @var{name}, @var{value}, @dots{})
244 
245 Write audio data from the matrix @var{y} to @var{filename} at sampling rate
246 @var{fs} with the file format determined by the file extension.
247 
248 Additional name/value argument pairs may be used to specify the
249 following options:
250 
251 @table @samp
252 @item BitsPerSample
253 Number of bits per sample. Valid values are 8, 16, 24, and 32. Default is
254 16.
255 
256 @item BitRate
257 Valid argument name, but ignored. Left for compatibility with @sc{matlab}.
258 
259 @item Quality
260 Quality setting for the Ogg Vorbis compressor. Values can range between 0
261 and 100 with 100 being the highest quality setting. Default is 75.
262 
263 @item Title
264 Title for the audio file.
265 
266 @item Artist
267 Artist name.
268 
269 @item Comment
270 Comment.
271 @end table
272 @seealso{audioread, audioformats, audioinfo}
273 @end deftypefn */)
274 {
275 #if defined (HAVE_SNDFILE)
276 
277  int nargin = args.length ();
278 
279  if (nargin < 3)
280  print_usage ();
281 
282  std::string filename = args(0).xstring_value ("audiowrite: FILENAME must be a string");
283 
284  double bias = 0.0;
285  double scale = 1.0;
286 
287  if (args(1).is_uint8_type ())
288  bias = scale = std::pow (2.0, 7);
289  else if (args(1).is_int16_type ())
290  scale = std::pow (2.0, 15);
291  else if (args(1).is_int32_type ())
292  scale = std::pow (2.0, 31);
293  else if (args(1).isinteger ())
294  err_wrong_type_arg ("audiowrite", args(1));
295 
296  Matrix audio = args(1).matrix_value ();
297 
298  // FIXME: SampleRate is supposed to be a positive scalar greater than 0
299  // Need check for that, and possibly convert to uint.
300  int samplerate = args(2).int_value ();
301 
302  std::string ext;
303  size_t dotpos = filename.find_last_of ('.');
304  if (dotpos != std::string::npos)
305  ext = filename.substr (dotpos + 1);
306  std::transform (ext.begin (), ext.end (), ext.begin (), ::tolower);
307 
308  sf_count_t items_to_write = audio.rows () * audio.columns ();
309 
310  if (audio.rows () == 1)
311  audio = audio.transpose ();
312 
313  OCTAVE_LOCAL_BUFFER (float, data, items_to_write);
314 
315  sf_count_t idx = 0;
316  for (int i = 0; i < audio.rows (); i++)
317  {
318  for (int j = 0; j < audio.columns (); j++)
319  {
320  double elem = (audio.xelem (i, j) - bias) / scale;
321  data[idx++] = std::min (std::max (elem, -1.0), 1.0);
322  }
323  }
324 
325  SF_INFO info;
326 
327  memset (&info, 0, sizeof (info));
328 
329  sf_count_t chunk_size = 0;
330 
331  if (ext == "ogg")
332  {
333  info.format = SF_FORMAT_VORBIS;
334 
335  // FIXME: There seems to be a bug writing ogg files in one shot that
336  // causes a segfault: https://bugs.debian.org/760898.
337  // Breaking it up into a series of smaller chunks appears to avoid the
338  // problem and produces valid files.
339  chunk_size = 0x100000;
340  }
341  else
342  info.format = SF_FORMAT_PCM_16;
343 
344  info.channels = audio.columns ();
345  info.samplerate = samplerate;
346  info.channels = audio.cols ();
347  info.format |= extension_to_format (ext);
348 
349  std::string title = "";
350  std::string artist = "";
351  std::string comment = "";
352  double quality = 0.75;
353 
354  for (int i = 3; i < nargin; i += 2)
355  {
356  if (i >= nargin - 1)
357  error ("audiowrite: invalid number of arguments");
358 
359  std::string keyword_orig = args(i).string_value ();
360  std::string keyword = args(i).xtolower ().string_value ();
361  octave_value value_arg = args(i+1);
362 
363  if (keyword == "bitspersample")
364  {
365  info.format &= ~SF_FORMAT_SUBMASK;
366  int bits = value_arg.int_value ();
367  if (bits == 8)
368  {
369  if ((info.format & SF_FORMAT_TYPEMASK) == SF_FORMAT_WAV)
370  info.format |= SF_FORMAT_PCM_U8;
371  else
372  info.format |= SF_FORMAT_PCM_S8;
373  }
374  else if (bits == 16)
375  info.format |= SF_FORMAT_PCM_16;
376  else if (bits == 24)
377  info.format |= SF_FORMAT_PCM_32;
378  else if (bits == 32)
379  {
380  if ((info.format & SF_FORMAT_TYPEMASK) == SF_FORMAT_WAV
381  && args(1).isfloat ())
382  info.format |= SF_FORMAT_FLOAT;
383  else
384  info.format |= SF_FORMAT_PCM_32;
385  }
386  else if (bits == 64)
387  info.format |= SF_FORMAT_DOUBLE;
388  else
389  error ("audiowrite: wrong number of bits specified");
390  }
391  else if (keyword == "bitrate")
392  warning_with_id ("Octave:audiowrite:unused-parameter",
393  "audiowrite: 'BitRate' accepted for Matlab "
394  "compatibility, but is ignored");
395  else if (keyword == "quality")
396  {
397  if (! value_arg.is_scalar_type ())
398  error ("audiowrite: Quality value must be a scalar");
399 
400  double value = value_arg.xdouble_value ("audiowrite: Quality value must be a numeric scalar between 0 and 100");
401 
402  if (octave::math::isnan (value) || value < 0 || value > 100)
403  error ("audiowrite: Quality value must be a number between 0 and 100");
404 
405  quality = value / 100;
406  }
407  else if (keyword == "title")
408  title = value_arg.string_value ();
409  else if (keyword == "artist")
410  artist = value_arg.string_value ();
411  else if (keyword == "comment")
412  comment = value_arg.string_value ();
413  else
414  error ("audiowrite: unrecognized option: '%s'", keyword_orig.c_str ());
415  }
416 
417  SNDFILE *file = sf_open (filename.c_str (), SFM_WRITE, &info);
418 
419  if (! file)
420  error ("audiowrite: failed to open output file '%s': %s",
421  filename.c_str (), sf_strerror (file));
422 
424 
425  frame.add_fcn (safe_close, file);
426 
427  sf_command (file, SFC_SET_VBR_ENCODING_QUALITY, &quality, sizeof (quality));
428 
429  if (title != "")
430  sf_set_string (file, SF_STR_TITLE, title.c_str ());
431 
432  if (artist != "")
433  sf_set_string (file, SF_STR_ARTIST, artist.c_str ());
434 
435  if (comment != "")
436  sf_set_string (file, SF_STR_COMMENT, comment.c_str ());
437 
438  sf_count_t total_items_written = 0;
439  sf_count_t offset = 0;
440 
441  if (chunk_size == 0)
442  chunk_size = items_to_write;
443 
444  while (total_items_written < items_to_write)
445  {
446  if (items_to_write - offset < chunk_size)
447  chunk_size = items_to_write - offset;
448 
449  sf_count_t items_written = sf_write_float (file, data+offset, chunk_size);
450 
451  if (items_written != chunk_size)
452  error ("audiowrite: write failed, wrote %ld of %ld items\n",
453  items_written, chunk_size);
454 
455  total_items_written += items_written;
456  offset += chunk_size;
457  }
458 
459  // FIXME: shouldn't we return something to indicate whether the file
460  // was written successfully?
461  return ovl ();
462 
463 #else
464 
465  octave_unused_parameter (args);
466 
467  err_disabled_feature ("audiowrite",
468  "reading and writing sound files through libsndfile");
469 
470 #endif
471 }
472 
473 /*
474 ## Test input validation
475 %!testif HAVE_SNDFILE
476 %! fail ("audiowrite (1, 1, 8e3)", "FILENAME must be a string");
477 %! fail ("audiowrite ('foo', int64 (1), 8e3)", "wrong type argument 'int64 scalar'");
478 %! fail ("audiowrite ('foo', 1, 8e3, 'bitspersample')", "invalid number of arguments");
479 %! fail ("audiowrite ('foo', 1, 8e3, 'bitspersample', 48)", "wrong number of bits specified");
480 %! fail ("audiowrite ('foo', 1, 8e3, 'quality', [2 3 4])", "Quality value must be a scalar");
481 %! fail ("audiowrite ('foo', 1, 8e3, 'quality', NaN)", "Quality value must be .* between 0 and 100");
482 %! fail ("audiowrite ('foo', 1, 8e3, 'quality', -1)", "Quality value must be .* between 0 and 100");
483 %! fail ("audiowrite ('foo', 1, 8e3, 'quality', 101)", "Quality value must be .* between 0 and 100");
484 %! fail ("audiowrite ('foo', 1, 8e3, 'foo', 'bar')", "unrecognized option: 'foo'");
485 */
486 
487 DEFUN_DLD (audioinfo, args, ,
488  doc: /* -*- texinfo -*-
489 @deftypefn {} {@var{info} =} audioinfo (@var{filename})
490 Return information about an audio file specified by @var{filename}.
491 
492 The output @var{info} is a structure containing the following fields:
493 
494 @table @samp
495 @item Filename
496 Name of the audio file.
497 
498 @item CompressionMethod
499 Audio compression method. Unused, only present for compatibility with
500 @sc{matlab}.
501 
502 @item NumChannels
503 Number of audio channels.
504 
505 @item SampleRate
506 Sample rate of the audio, in Hertz.
507 
508 @item TotalSamples
509 Number of samples in the file.
510 
511 @item Duration
512 Duration of the audio, in seconds.
513 
514 @item BitsPerSample
515 Number of bits per sample.
516 
517 @item BitRate
518 Audio bit rate. Unused, only present for compatibility with @sc{matlab}.
519 
520 @item Title
521 @qcode{"Title"} audio metadata value as a string, or empty if not present.
522 
523 @item Artist
524 @qcode{"Artist"} audio metadata value as a string, or empty if not present.
525 
526 @item Comment
527 @qcode{"Comment"} audio metadata value as a string, or empty if not present.
528 @end table
529 @seealso{audioread, audiowrite}
530 @end deftypefn */)
531 {
532 #if defined (HAVE_SNDFILE)
533 
534  if (args.length () != 1)
535  print_usage ();
536 
537  std::string filename = args(0).xstring_value ("audioinfo: FILENAME must be a string");
538 
540  if (! fs.exists ())
541  error ("audioinfo: FILENAME '%s' not found", filename.c_str ());
542 
543  SF_INFO info;
544  info.format = 0;
545  SNDFILE *file = sf_open (filename.c_str (), SFM_READ, &info);
546 
547  if (! file)
548  error ("audioinfo: failed to open input file '%s': %s",
549  filename.c_str (), sf_strerror (file));
550 
552 
553  frame.add_fcn (safe_close, file);
554 
556 
558 
559  result.assign ("Filename", full_name);
560  result.assign ("CompressionMethod", "");
561  result.assign ("NumChannels", info.channels);
562  result.assign ("SampleRate", info.samplerate);
563  result.assign ("TotalSamples", info.frames);
564 
565  double dframes = info.frames;
566  double drate = info.samplerate;
567  result.assign ("Duration", dframes / drate);
568 
569  int bits;
570  switch (info.format & SF_FORMAT_SUBMASK)
571  {
572  case SF_FORMAT_PCM_S8:
573  bits = 8;
574  break;
575  case SF_FORMAT_PCM_U8:
576  bits = 8;
577  break;
578  case SF_FORMAT_PCM_16:
579  bits = 16;
580  break;
581  case SF_FORMAT_PCM_24:
582  bits = 24;
583  break;
584  case SF_FORMAT_PCM_32:
585  bits = 32;
586  break;
587  default:
588  bits = -1;
589  break;
590  }
591 
592  result.assign ("BitsPerSample", bits);
593  result.assign ("BitRate", -1);
594  result.assign ("Title", sf_get_string (file, SF_STR_TITLE));
595  result.assign ("Artist", sf_get_string (file, SF_STR_ARTIST));
596  result.assign ("Comment", sf_get_string (file, SF_STR_COMMENT));
597 
598  return ovl (result);
599 
600 #else
601 
602  octave_unused_parameter (args);
603 
604  err_disabled_feature ("audioinfo",
605  "reading and writing sound files through libsndfile");
606 
607 #endif
608 }
609 
610 #if defined (HAVE_SNDFILE)
611 
612 static void
613 audio_sub_formats (int format)
614 {
615  int count;
616  sf_command (nullptr, SFC_GET_FORMAT_SUBTYPE_COUNT, &count, sizeof (int));
617 
618  for (int i = 0; i < count; i++)
619  {
620  SF_FORMAT_INFO info;
621  info.format = i;
622  sf_command (nullptr, SFC_GET_FORMAT_SUBTYPE, &info, sizeof (info));
623 
624  SF_INFO sfinfo;
625  memset (&sfinfo, 0, sizeof (sfinfo));
626  sfinfo.channels = 1;
627  sfinfo.format = (format & SF_FORMAT_TYPEMASK) | info.format;
628 
629  if (sf_format_check (&sfinfo))
630  octave_stdout << " " << info.name << std::endl;
631  }
632 }
633 
634 #endif
635 
636 DEFUN_DLD (audioformats, args, ,
637  doc: /* -*- texinfo -*-
638 @deftypefn {} {} audioformats ()
639 @deftypefnx {} {} audioformats (@var{format})
640 Display information about all supported audio formats.
641 
642 If the optional argument @var{format} is given, then display only formats
643 with names that start with @var{format}.
644 @seealso{audioread, audiowrite}
645 @end deftypefn */)
646 {
647 #if defined (HAVE_SNDFILE)
648 
649  if (args.length () > 1)
650  print_usage ();
651 
652  std::string search = "";
653  if (args.length () > 0)
654  {
655  search = args(0).string_value ();
656  std::transform (search.begin (), search.end (), search.begin (), tolower);
657  }
658 
659  int count;
660  sf_command (nullptr, SFC_GET_FORMAT_MAJOR_COUNT, &count, sizeof (int));
661 
662  for (int i = 0; i < count; i++)
663  {
664  SF_FORMAT_INFO info;
665  info.format = i;
666  sf_command (nullptr, SFC_GET_FORMAT_MAJOR, &info, sizeof (info));
667  bool match = true;
668 
669  if (! search.empty ())
670  {
671  std::string nm = info.name;
672  std::transform (nm.begin (), nm.end (), nm.begin (), tolower);
673  match = nm.compare (0, search.length (), search) == 0;
674  }
675 
676  if (match)
677  {
678  octave_stdout << "name: " << info.name << std::endl;
679  octave_stdout << "extension: " << info.extension << std::endl;
680  octave_stdout << "id: " << info.format << std::endl;
681  octave_stdout << "subformats:" << std::endl;
682 
683  audio_sub_formats (info.format);
684  }
685  }
686 
687 #else
688 
689  octave_unused_parameter (args);
690 
691  err_disabled_feature ("audioformats",
692  "getting sound formats through libsndfile");
693 
694 #endif
695 
696  return octave_value_list ();
697 }
bool isinteger(double x)
Definition: lo-mappers.h:240
octave_idx_type rows(void) const
Definition: Array.h:404
void warning_with_id(const char *id, const char *fmt,...)
Definition: error.cc:816
For example cd octave end example noindent changes the current working directory to file
Definition: dirfns.cc:124
int int_value(bool req_int=false, bool frc_str_conv=false) const
Definition: ov.h:793
std::string canonicalize_file_name(const std::string &name)
Definition: file-ops.cc:685
std::string string_value(bool force=false) const
Definition: ov.h:955
double xdouble_value(const char *fmt,...) const
OCTINTERP_API void print_usage(void)
Definition: defun.cc:54
intNDArray< octave_uint8 > uint8NDArray
Definition: uint8NDArray.h:33
const T * fortran_vec(void) const
Definition: Array.h:584
void add_fcn(void(*fcn)(void))
bool isnan(bool)
Definition: lo-mappers.h:187
void error(const char *fmt,...)
Definition: error.cc:578
bool isinf(double x)
Definition: lo-mappers.h:225
std::string filename
Definition: urlwrite.cc:121
octave_idx_type columns(void) const
Definition: Array.h:413
intNDArray< octave_int16 > int16NDArray
Definition: int16NDArray.h:33
octave_idx_type cols(void) const
Definition: Array.h:412
Matrix transpose(void) const
Definition: dMatrix.h:132
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
Definition: utils.cc:975
intNDArray< octave_int8 > int8NDArray
Definition: int8NDArray.h:33
OCTAVE_EXPORT octave_value_list isfloat
Definition: data.cc:3212
if(nargin< 2) print_usage()
Definition: cellfun.cc:407
static int elem
Definition: __contourc__.cc:47
octave_int< T > pow(const octave_int< T > &a, const octave_int< T > &b)
idx type
Definition: ov.cc:3114
static std::list< std::string > search(const std::string &path, const std::string &original_name, bool all)
Definition: kpse.cc:395
Definition: dMatrix.h:36
LS_TEXT format
Definition: load-save.cc:1616
static bool initialized
Definition: defaults.cc:48
void err_wrong_type_arg(const char *name, const char *s)
Definition: errwarn.cc:162
With real return the complex result
Definition: data.cc:3260
T & xelem(octave_idx_type n)
Definition: Array.h:458
octave::unwind_protect frame
Definition: graphics.cc:12190
charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:227
intNDArray< octave_int32 > int32NDArray
Definition: int32NDArray.h:33
#define octave_stdout
Definition: pager.h:174
octave::sys::time start
Definition: graphics.cc:12337
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl(args(0).isinteger())
void scale(Matrix &m, double x, double y, double z)
Definition: graphics.cc:5442
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
Definition: oct-locbuf.h:41
bool exists(void) const
Definition: file-stat.h:144
octave::sys::file_stat fs(filename)
args.length() nargin
Definition: file-io.cc:589
ColumnVector transform(const Matrix &m, double x, double y, double z)
Definition: graphics.cc:5410
for i
Definition: data.cc:5264
#define DEFUN_DLD(name, args_name, nargout_name, doc)
Macro to define an at run time dynamically loadable builtin function.
Definition: defun-dld.h:58
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
void err_disabled_feature(const std::string &fcn, const std::string &feature, const std::string &pkg)
Definition: errwarn.cc:50
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
nd group nd example For each display the value
Definition: sysdep.cc:866
bool is_scalar_type(void) const
Definition: ov.h:717
T x_nint(T x)
Definition: lo-mappers.h:284
charNDArray min(char d, const charNDArray &m)
Definition: chNDArray.cc:204