Mercurial > hg > octave-nkf
changeset 3737:b736f8b8f0a1
[project @ 2000-11-16 18:01:08 by jwe]
author | jwe |
---|---|
date | Thu, 16 Nov 2000 18:01:10 +0000 |
parents | ac4609ffc702 |
children | f20c30fa3a8d |
files | scripts/ChangeLog scripts/plot/contour.m src/ChangeLog src/DLD-FUNCTIONS/rand.cc src/file-io.cc |
diffstat | 5 files changed, 41 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2000-11-16 Paul Kienzle <pkienzle@kienzle.powernet.co.uk> + + * plot/contour.m: Reorder args for Matlab compatibility. + 2000-10-27 Mats Jansson <mats.e.jansson@home.se> * set/create_set.m: Avoid empty matrix in matrix list warning.
--- a/scripts/plot/contour.m +++ b/scripts/plot/contour.m @@ -18,7 +18,8 @@ ## 02111-1307, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} contour (@var{z}, @var{n}, @var{x}, @var{y}) +## @deftypefn {Function File} {} contour (@var{z}, @var{n}) +## @deftypefnx {Function File} {} contour (@var{x}, @var{y}, @var{z}, @var{n}) ## Make a contour plot of the three-dimensional surface described by ## @var{z}. Someone needs to improve @code{gnuplot}'s contour routines ## before this will be very useful. @@ -28,17 +29,19 @@ ## Author: jwe -function contour (z, n, x, y) - - if (nargin == 1) - n = 10; - endif +function contour (x, y, z, n) ## XXX FIXME XXX -- these plot states should really just be set ## temporarily, probably inside an unwind_protect block, but there is ## no way to determine their current values. if (nargin == 1 || nargin == 2) + z = x; + if (nargin == 1) + n = 10; + else + n = y; + endif if (is_matrix (z)) gset nosurface; gset contour;
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2000-11-16 Paul Kienzle <pkienzle@kienzle.powernet.co.uk> + + * file-io.cc (Ffprintf): If no file id parameter, don't return + count of characters if nargout is 0 (for compatibility with + Matlab). + +2000-11-16 Ben Sapp <bsapp@lanl.gov> + + * DLD-FUNCTIONS/rand.cc (do_rand): Declare loop counter as + volatile int, not just volatile. + 2000-10-31 John W. Eaton <jwe@bevo.che.wisc.edu> * load-save.cc (skip_comments): Allow % as comment character too.
--- a/src/DLD-FUNCTIONS/rand.cc +++ b/src/DLD-FUNCTIONS/rand.cc @@ -298,7 +298,7 @@ Matrix rand_mat (n, m); for (volatile int j = 0; j < m; j++) - for (volatile i = 0; i < n; i++) + for (volatile int i = 0; i < n; i++) { double val; switch (current_distribution)
--- a/src/file-io.cc +++ b/src/file-io.cc @@ -630,7 +630,7 @@ return retval; } -DEFUN (fprintf, args, , +DEFUN (fprintf, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} fprintf (@var{fid}, @var{template}, @dots{})\n\ This function is just like @code{printf}, except that the output is\n\ @@ -638,6 +638,7 @@ @end deftypefn") { double retval = -1.0; + bool return_char_count = true; int nargin = args.length (); @@ -646,8 +647,16 @@ octave_stream os; int fmt_n = 0; - if (args(0).is_string ()) - os = octave_stream_list::lookup (1, "fprintf"); + if (args(0).is_string ()) + { + os = octave_stream_list::lookup (1, "fprintf"); + + // For compatibility with Matlab, which does not return the + // character count when behaving like printf (no file id + // parameter). + + return_char_count = (nargout != 0); + } else { fmt_n = 1; @@ -679,7 +688,10 @@ else print_usage ("fprintf"); - return retval; + if (return_char_count) + return retval; + else + return octave_value(); } DEFUN (fputs, args, ,