Mercurial > hg > octave-nkf
changeset 2325:b5568c31ee2c
[project @ 1996-07-15 22:20:21 by jwe]
line wrap: on
line diff
--- a/scripts/audio/lin2mu.m +++ b/scripts/audio/lin2mu.m @@ -27,7 +27,7 @@ ## Adapted-By: jwe function y = lin2mu (x) - + if (nargin != 1) usage ("y = lin2mu (x)"); endif @@ -35,7 +35,7 @@ if (! is_vector (x)) error ("lin2mu: x must be a vector"); endif - + ## transform 8-bit format to 16-bit if (max (abs (x)) <= 128) x = 256 .* x; @@ -45,7 +45,7 @@ sig = sign(x) + (x == 0); ## take absolute value of x, but force it to be smaller than 32636; - ## add bias + ## add bias x = min (abs (x), 32635 * ones (size (x))) + 132; ## find exponent and fraction of bineary representation
--- a/scripts/audio/loadaudio.m +++ b/scripts/audio/loadaudio.m @@ -19,13 +19,13 @@ ## usage: X = loadaudio (name [, ext [, bit]]) ## -## Loads audio data from the file "name.ext" into the data vector X. +## Loads audio data from the file "name.ext" into the data vector X. ## Default value for the "ext" argument, which has to be written ## without the initial ".", is "lin". ## Currently, the following audio formats are supported: ## *) mu-law encoding with extension "mu", "au" or "snd" ## *) linear encoding with extension "lin" or "raw" -## +## ## The `bit' argument can be either 8 (default) or 16. ## Depending on the value of bit, linearly encoded files are ## interpreted as being in 8 and 16 bit format, respectively, and @@ -37,7 +37,7 @@ ## Adapted-By: jwe function X = loadaudio (name, ext, bit) - + if (nargin == 0 || nargin > 3) usage ("loadaudio (name [, ext [, bit]])"); endif @@ -76,7 +76,7 @@ endif fclose (num); - + endfunction
--- a/scripts/audio/mu2lin.m +++ b/scripts/audio/mu2lin.m @@ -21,7 +21,7 @@ ## ## If x is a vector of audio data with mu-law encoding, mu2lin (x) ## holds the same data with linear encoding. -## The optional argument bit specifies whether the input data is +## The optional argument bit specifies whether the input data is ## 8 bit (default) or 16 bit. ## Author: AW <Andreas.Weingessel@ci.tuwien.ac.at> @@ -29,7 +29,7 @@ ## Adapted-By: jwe function y = mu2lin (x, bit) - + if (nargin == 1) bit = 8; elseif (nargin == 2) @@ -43,7 +43,7 @@ if (! is_vector (x)) error ("mu2lin: x must be a vector"); endif - + exp_lut = [0; 132; 396; 924; 1980; 4092; 8316; 16764]; ## invert x bitwise
--- a/scripts/audio/playaudio.m +++ b/scripts/audio/playaudio.m @@ -17,7 +17,7 @@ ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA ## 02111-1307, USA. -## usage: playaudio (name [, ext]) +## usage: playaudio (name [, ext]) ## playaudio (X) ## ## `playaudio ("name" [, "ext"])' plays the audio file "name.ext". The @@ -25,9 +25,9 @@ ## without the initial ".", is "lin". ## Currently, the following audio formats are suppored: ## *) linear encoding with extension "lin" or "raw", played using -## /dev/dsp +## /dev/dsp ## *) mu-law encoding with extension "mu", "au" or "snd", played -## using /dev/audio +## using /dev/audio ## ## `playaudio (X)' plays the audio data contained in the vector X. @@ -36,12 +36,12 @@ ## Adapted-By: jwe function playaudio (name, ext) - + file = octave_tmp_file_name (); usage_msg = "playaudio (name [, ext]) or playaudio (X)"; - - if (nargin == 1 && is_vector (name) && ! isstr (name)) + + if (nargin == 1 && is_vector (name) && ! isstr (name)) ## play a vector [nr, nc] = size (name); if (nc != 1)
--- a/scripts/audio/saveaudio.m +++ b/scripts/audio/saveaudio.m @@ -21,7 +21,7 @@ ## ## Saves a vector X of audio data in the file "name.ext". ## The format of the audio file is determined by ext which has to be -## written without an inital "."; default value for ext is "lin". +## written without an inital "."; default value for ext is "lin". ## ## Currently, the following audio formats are supported: ## *) mu-law files with extension "mu", "au" or "snd" @@ -34,7 +34,7 @@ ## Adapted-By: jwe function saveaudio (name, X, ext, bit) - + if (nargin < 2 || nargin > 4) usage ("saveaudio (X, name [, ext [, bit]])"); endif @@ -61,7 +61,7 @@ num = fopen ([name, ".", ext], "w"); - if (strcmp (ext, "lin") || strcmp (ext, "raw")) + if (strcmp (ext, "lin") || strcmp (ext, "raw")) if (bit == 8) ld = max (abs (X)); if (ld > 127) # convert 16 to 8 bit @@ -86,5 +86,5 @@ endif fclose (num); - + endfunction
--- a/scripts/audio/setaudio.m +++ b/scripts/audio/setaudio.m @@ -26,7 +26,7 @@ ## Adapted-By: jwe function setaudio (w_type, value) - + if (nargin == 0) system ("mixer"); elseif (nargin == 1) @@ -36,5 +36,5 @@ else usage ("setaudio ([w_type [, value]])"); endif - + endfunction
--- a/scripts/control/are.m +++ b/scripts/control/are.m @@ -77,7 +77,7 @@ ## use Boley-Golub (Syst. Contr. Letters, 1984) method, not the ## ## n-1 - ## rank ([ B A*B ... A^ *B]) method + ## rank ([ B A*B ... A^ *B]) method [d, h] = balance ([a, -b; -c, -a'], opt); [u, s] = schur (h, "A");
--- a/scripts/control/dare.m +++ b/scripts/control/dare.m @@ -27,7 +27,7 @@ ## ## a: nxn ## b: nxm -## c: nxn, symmetric positive semidefinite +## c: nxn, symmetric positive semidefinite ## r: mxm, invertible ## ## If c is not square, then the function attempts to use c'*c instead. @@ -40,7 +40,7 @@ ## Systems, Vol 5, no 2 (1992) pp 165-194. ## ## opt is an option passed to the eigenvalue balancing routine default -## is "B". +## is "B". ## ## See also: balance, are
--- a/scripts/control/dlqe.m +++ b/scripts/control/dlqe.m @@ -19,7 +19,7 @@ ## Usage: [l, m, p, e] = dlqe (A, G, C, SigW, SigV {,Z}) ## -## Linear quadratic estimator (Kalman filter) design for the +## Linear quadratic estimator (Kalman filter) design for the ## discrete time system ## ## x[k+1] = A x[k] + B u[k] + G w[k] @@ -30,7 +30,7 @@ ## ## Z (if specified) is cov(w,v); otherwise cov(w,v) = 0. ## -## Observer structure is +## Observer structure is ## z[k+1] = A z[k] + B u[k] + k(y[k] - C z[k] - D u[k]). ## ## Returns:
--- a/scripts/control/dlqr.m +++ b/scripts/control/dlqr.m @@ -60,7 +60,7 @@ endif ## Check q. - + if ((n1 = is_square (q)) == 0 || n1 != n) error ("dlqr: q must be square and conformal with a"); endif
--- a/scripts/control/dlyap.m +++ b/scripts/control/dlyap.m @@ -20,7 +20,7 @@ ## Usage: x = dlyap (a, b) ## ## Solve a x a' - x + b = 0 (discrete Lyapunov equation) for square -## matrices a and b. If b is not square, then the function attempts +## matrices a and b. If b is not square, then the function attempts ## to solve either ## ## a x a' - x + b b' = 0
--- a/scripts/control/lqe.m +++ b/scripts/control/lqe.m @@ -19,7 +19,7 @@ ## Usage: [k, p, e] = lqe (A, G, C, SigW, SigV {,Z}) ## -## Linear quadratic estimator (Kalman filter) design for the +## Linear quadratic estimator (Kalman filter) design for the ## continuous time system ## ## dx/dt = A x + B u + G w
--- a/scripts/control/lqr.m +++ b/scripts/control/lqr.m @@ -59,7 +59,7 @@ endif ## Check q. - + if ((n1 = is_square (q)) == 0 || n1 != n) error ("lqr: q must be square and conformal with a"); endif
--- a/scripts/control/lyap.m +++ b/scripts/control/lyap.m @@ -24,14 +24,14 @@ ## ## a x + x b + c = 0 ## -## If only (a, b) are specified, then lyap returns the solution of the +## If only (a, b) are specified, then lyap returns the solution of the ## Lyapunov equation ## ## a' x + x a + b = 0 ## ## If b is not square, then lyap returns the solution of either ## -## a' x + x a + b' b = 0 +## a' x + x a + b' b = 0 ## ## or ## @@ -66,7 +66,7 @@ b = b * b'; a = a'; - else + else ## Try to solve a'x + x a + b' b = 0. @@ -85,7 +85,7 @@ b = a; a = b'; - else + else ## Check dimensions.
--- a/scripts/elfun/acoth.m +++ b/scripts/elfun/acoth.m @@ -17,7 +17,7 @@ ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA ## 02111-1307, USA. -## acoth (z): compute the inverse hyperbolic cotangent for each element of z. +## acoth (z): compute the inverse hyperbolic cotangent for each element of z. ## Author: jwe
--- a/scripts/elfun/acsc.m +++ b/scripts/elfun/acsc.m @@ -22,11 +22,11 @@ ## Author: jwe function w = acsc (z) - + if (nargin != 1) usage ("acsc (z)"); endif w = asin (1 ./ z); - + endfunction \ No newline at end of file
--- a/scripts/elfun/acsch.m +++ b/scripts/elfun/acsch.m @@ -22,11 +22,11 @@ ## Author: jwe function w = acsch (z) - + if (nargin != 1) usage ("acsch (z)"); endif w = asinh (1 ./ z); - + endfunction \ No newline at end of file
--- a/scripts/elfun/asec.m +++ b/scripts/elfun/asec.m @@ -22,11 +22,11 @@ ## Author: jwe function w = asec (z) - + if (nargin != 1) usage ("asec (z)"); endif w = acos (1 ./ z); - + endfunction \ No newline at end of file
--- a/scripts/elfun/asech.m +++ b/scripts/elfun/asech.m @@ -22,11 +22,11 @@ ## Author: jwe function w = asech (z) - + if (nargin != 1) usage ("acosh (z)"); endif w = acosh (1 ./ z); - + endfunction
--- a/scripts/elfun/cot.m +++ b/scripts/elfun/cot.m @@ -22,11 +22,11 @@ ## Author: jwe function w = cot (z) - + if (nargin != 1) usage ("cot (z)"); endif w = 1 ./ tan(z); - + endfunction \ No newline at end of file
--- a/scripts/elfun/coth.m +++ b/scripts/elfun/coth.m @@ -22,11 +22,11 @@ ## Author: jwe function w = coth (z) - + if (nargin != 1) usage ("coth (z)"); endif w = 1 ./ tanh(z); - + endfunction \ No newline at end of file
--- a/scripts/elfun/csc.m +++ b/scripts/elfun/csc.m @@ -22,11 +22,11 @@ ## Author: jwe function w = csc (z) - + if (nargin != 1) usage ("csc (z)"); endif w = 1 ./ sin(z); - + endfunction
--- a/scripts/elfun/csch.m +++ b/scripts/elfun/csch.m @@ -22,11 +22,11 @@ ## Author: jwe function w = csch (z) - + if (nargin != 1) usage ("csch (z)"); endif w = 1 ./ sinh(z); - + endfunction
--- a/scripts/elfun/gcd.m +++ b/scripts/elfun/gcd.m @@ -18,7 +18,7 @@ ## 02111-1307, USA. ## usage: gcd (a, ...) -## +## ## [g [, v]] = gcd (a) returns the greatest common divisor g of the ## entries of the integer vector a, and an integer vector v such that ## g = v(1) * a(k) + ... + v(k) * a(k). @@ -37,11 +37,11 @@ a = [a, (va_arg ())]; endfor endif - + if (round (a) != a) error ("gcd: all arguments must be integer"); endif - + g = abs (a(1)); v = sign (a(1)); for k = 1:(length (a) - 1) @@ -55,6 +55,5 @@ g = x(1); v = [x(2) * v, x(3) * (sign (a(k+1)))]; endfor - + endfunction - \ No newline at end of file
--- a/scripts/elfun/lcm.m +++ b/scripts/elfun/lcm.m @@ -34,11 +34,11 @@ a = [a, (va_arg ())]; endfor endif - + if (round (a) != a) error ("lcm: all arguments must be integer"); endif - + if (any (a) == 0) l = 0; else @@ -48,6 +48,5 @@ l = l * a(k+1) / gcd (l, a(k+1)); endfor endif - + endfunction - \ No newline at end of file
--- a/scripts/elfun/log2.m +++ b/scripts/elfun/log2.m @@ -22,11 +22,11 @@ ## Author: jwe function w = log2 (z) - + if (nargin != 1) usage ("log2 (z)"); endif w = log(z) / log(2); - + endfunction \ No newline at end of file
--- a/scripts/elfun/sec.m +++ b/scripts/elfun/sec.m @@ -22,11 +22,11 @@ ## Author: jwe function w = sec (z) - + if (nargin != 1) usage ("sec (z)"); endif - + w = 1 ./ cos(z); - + endfunction
--- a/scripts/elfun/sech.m +++ b/scripts/elfun/sech.m @@ -22,11 +22,11 @@ ## Author: jwe function w = sech (z) - + if (nargin != 1) usage ("sech (z)"); endif w = 1 ./ cosh(z); - + endfunction
--- a/scripts/general/int2str.m +++ b/scripts/general/int2str.m @@ -21,7 +21,7 @@ ## ## Round x to the nearest integer and format as a string. ## -## See also: sprintf, num2str +## See also: sprintf, num2str ## Author: jwe
--- a/scripts/general/is_square.m +++ b/scripts/general/is_square.m @@ -32,7 +32,7 @@ if (nargin == 1) [nr, nc] = size (x); - if (nr == nc) + if (nr == nc) retval = nr; else retval = 0;
--- a/scripts/general/is_symmetric.m +++ b/scripts/general/is_symmetric.m @@ -21,7 +21,7 @@ ## ## If x is symmetric, return the dimension of x, otherwise, return 0. ## -## See also: size, rows, columns, length, is_matrix, is_scalar, +## See also: size, rows, columns, length, is_matrix, is_scalar, ## is_square, is_vector ## Author: A. S. Hodel <scotte@eng.auburn.edu>
--- a/scripts/general/is_vector.m +++ b/scripts/general/is_vector.m @@ -20,7 +20,7 @@ ## usage: is_vector (x) ## ## Return 1 if the either the number of rows (columns) of x is 1 and -## the number of columns (rows) is greater than one. Otherwise, return 0. +## the number of columns (rows) is greater than one. Otherwise, return 0. ## ## See also: size, rows, columns, length, is_scalar, is_matrix
--- a/scripts/general/logspace.m +++ b/scripts/general/logspace.m @@ -24,7 +24,7 @@ ## ## If the final argument is omitted, n = 50 is assumed. ## -## All three arguments must be scalars. +## All three arguments must be scalars. ## ## Note that if if x2 is pi, the points are between 10^x1 and pi, NOT ## 10^x1 and 10^pi. @@ -46,7 +46,7 @@ npoints = fix (n); else error ("logspace: arguments must be scalars"); - endif + endif else usage ("logspace (x1, x2 [, n])"); endif
--- a/scripts/image/colormap.m +++ b/scripts/image/colormap.m @@ -18,15 +18,15 @@ ## 02111-1307, USA. ## Set the current colormap. -## +## ## colormap (map) sets the current colormap to map. map should be an n ## row by 3 column matrix. The columns contain red, green, and blue ## intensities respectively. All entries should be between 0 and 1 ## inclusive. The new colormap is returned. -## +## ## colormap ("default") restores the default colormap (a gray scale ## colormap with 64 entries). The default colormap is returned. -## +## ## colormap with no arguments returns the current colormap. ## Author: Tony Richardson <amr@mpl.ucsd.edu>
--- a/scripts/image/loadimage.m +++ b/scripts/image/loadimage.m @@ -44,7 +44,7 @@ endif ## XXX FIXME XXX -- file is assumed to have variables X and map. - + eval (['load ', file]); endfunction
--- a/scripts/image/ocean.m +++ b/scripts/image/ocean.m @@ -36,7 +36,7 @@ endif cutin = fix (number/3); - + dr = (number - 1) / cutin; r = prepad ([0:dr:(number-1)], number)';
--- a/scripts/image/saveimage.m +++ b/scripts/image/saveimage.m @@ -42,7 +42,7 @@ ## formats are used, otherwise the full color formats are used. ## ## The conversion to PostScript is based on pbmtolps.c, which was -## written by +## written by ## ## George Phillips <phillips@cs.ubc.ca> ## Department of Computer Science @@ -58,7 +58,7 @@ ## Rewritten by jwe to avoid using octoppm and pbm routines so that ## people who don't have the the pbm stuff installed can still use this -## function. +## function. ## ## The conversion to PostScript is based on pnmtops.c, which is part of ## the portable bitmap utilties and bears this copyright notice:
--- a/scripts/linear-algebra/kron.m +++ b/scripts/linear-algebra/kron.m @@ -20,7 +20,7 @@ ## Usage: x = kron (a, b) ## ## Form the Kronecker product of two matrices, defined block by block -## as +## as ## ## x = [a(i,j) b]
--- a/scripts/linear-algebra/null.m +++ b/scripts/linear-algebra/null.m @@ -25,7 +25,7 @@ ## The dimension of the null space is taken as the number of singular ## values of A not greater than tol; the default for tol is ## max (size (A)) * sigma_max (A) * eps, where sigma_max (A) is the -## maximal singular value of A. +## maximal singular value of A. ## Author: KH <Kurt.Hornik@ci.tuwien.ac.at> ## Created: 24 December 1993. @@ -48,7 +48,7 @@ if (nargin == 1) tol = max (size (A)) * s (1) * eps; elseif (nargin != 2) - usage ("null (A [, tol])"); + usage ("null (A [, tol])"); endif rank = sum (s > tol);
--- a/scripts/linear-algebra/orth.m +++ b/scripts/linear-algebra/orth.m @@ -48,7 +48,7 @@ if (nargin == 1) tol = max (size (A)) * s (1) * eps; elseif (nargin != 2) - usage ("orth (A [, tol])"); + usage ("orth (A [, tol])"); endif rank = sum (s > tol);
--- a/scripts/miscellaneous/popen2.m +++ b/scripts/miscellaneous/popen2.m @@ -61,7 +61,7 @@ pid = fork (); - if (pid == 0) + if (pid == 0) fclose (stdin_pipe (2)); fclose (stdout_pipe (1)); @@ -89,7 +89,7 @@ out = stdout_pipe (1); endif - elseif (pid < 0) + elseif (pid < 0) error ("popen2: fork failed -- unable to create child process"); endif else
--- a/scripts/plot/__plt__.m +++ b/scripts/plot/__plt__.m @@ -65,7 +65,7 @@ y_set = 0; else y = new; - y_set = 1; + y_set = 1; endif else x = new;
--- a/scripts/plot/axis.m +++ b/scripts/plot/axis.m @@ -26,7 +26,7 @@ ## ## With no arguments, turns autoscaling on. ## -## If your plot is already drawn, then you need to REPLOT before +## If your plot is already drawn, then you need to REPLOT before ## the new axis limits will take effect. ## Author: jwe
--- a/scripts/plot/bar.m +++ b/scripts/plot/bar.m @@ -37,7 +37,7 @@ ## are equivalent. ## ## See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, -## stairs, gplot, gsplot, replot, xlabel, ylabel, title +## stairs, gplot, gsplot, replot, xlabel, ylabel, title ## Author: jwe
--- a/scripts/plot/bottom_title.m +++ b/scripts/plot/bottom_title.m @@ -22,7 +22,7 @@ ## NOTE: this will work only with gnuplot installed with ## multiplot patch ## -## makes a title with the given text at the bottom of the plot +## makes a title with the given text at the bottom of the plot ## rather than the top. ## @@ -34,7 +34,7 @@ if (! gnuplot_has_multiplot) error ("bottom_title: gnuplot does not appear to support this feature"); endif - + if (nargin != 1) usage ("bottom_title (text)"); endif
--- a/scripts/plot/contour.m +++ b/scripts/plot/contour.m @@ -20,7 +20,7 @@ ## usage: contour (z, n, x, y) ## ## See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, -## bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title +## bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title ## Author: jwe @@ -76,7 +76,7 @@ endif else error ("mesh: x and y must be vectors and z must be a matrix"); - endif + endif else usage ("mesh (z, levels, x, y)"); endif
--- a/scripts/plot/grid.m +++ b/scripts/plot/grid.m @@ -24,7 +24,7 @@ ## If the argument is omitted, "on" is assumed. ## ## See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, -## bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title +## bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title ## Author: jwe
--- a/scripts/plot/hist.m +++ b/scripts/plot/hist.m @@ -45,7 +45,7 @@ if (nargin < 1 || nargin > 2) usage ("[nn, xx] = hist (y, x)"); endif - + if (is_vector (y)) max_val = max (y); min_val = min (y);
--- a/scripts/plot/loglog.m +++ b/scripts/plot/loglog.m @@ -21,13 +21,13 @@ ## loglog (x1, y1, x2, y2, ...) ## loglog (x, y, fmt) ## -## Make a 2D plot of y versus x using a log scale for the x axis. +## Make a 2D plot of y versus x using a log scale for the x axis. ## ## See the help message for the plot command for a description of how -## the arguments are interpreted. +## the arguments are interpreted. ## ## See also: plot, semilogy, loglog, polar, mesh, contour, bar, stairs, -## gplot, gsplot, replot, xlabel, ylabel, title +## gplot, gsplot, replot, xlabel, ylabel, title ## Author: jwe
--- a/scripts/plot/mesh.m +++ b/scripts/plot/mesh.m @@ -25,8 +25,8 @@ ## columns of z correspond to different x values and rows of z correspond ## to different y values. ## -## See also: plot, semilogx, semilogy, loglog, polar, meshgrid, meshdom, -## contour, bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title +## See also: plot, semilogx, semilogy, loglog, polar, meshgrid, meshdom, +## contour, bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title ## Author: jwe @@ -100,7 +100,7 @@ endif else error ("mesh: x and y must be vectors and z must be a matrix"); - endif + endif else usage ("mesh (z)"); endif
--- a/scripts/plot/meshdom.m +++ b/scripts/plot/meshdom.m @@ -25,7 +25,7 @@ ## See the file sombrero.m for an example of using mesh and meshdom. ## ## See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, -## bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title +## bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title ## Author: jwe
--- a/scripts/plot/meshgrid.m +++ b/scripts/plot/meshgrid.m @@ -26,7 +26,7 @@ ## [xx, yy] = meshgrid (x) is an abbreviation for [xx, yy] = meshgrid (x, x). ## ## See also: plot, semilogx, semilogy, loglog, polar, mesh, meshdom, contour, -## bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title +## bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title ## Author: jwe
--- a/scripts/plot/multiplot.m +++ b/scripts/plot/multiplot.m @@ -23,7 +23,7 @@ ## ## If multiplot(0,0) then it will close multiplot mode and and if ## arguments are non-zero, then it will set up multiplot mode with -## xn,yn subplots along x and y axes. +## xn,yn subplots along x and y axes. ## ## NOTE: this will work only with gnuplot installed with ## multiplot patch @@ -37,7 +37,7 @@ if (! gnuplot_has_multiplot) error ("multiplot: gnuplot does not appear to support this feature"); endif - + ## global variables to keep track of multiplot options global multiplot_mode
--- a/scripts/plot/oneplot.m +++ b/scripts/plot/oneplot.m @@ -17,7 +17,7 @@ ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA ## 02111-1307, USA. -## usage: oneplot +## usage: oneplot ## ## NOTE: this will work only with gnuplot installed with ## multiplot patch @@ -34,7 +34,7 @@ if (! gnuplot_has_multiplot) error ("oneplot: gnuplot does not appear to support this feature"); endif - + global multiplot_mode set nomultiplot;
--- a/scripts/plot/plot.m +++ b/scripts/plot/plot.m @@ -59,7 +59,7 @@ ## b will be plotted with points of type "*". ## ## See also: semilogx, semilogy, loglog, polar, mesh, contour, __pltopt__ -## bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title +## bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title ## Author: jwe
--- a/scripts/plot/plot_border.m +++ b/scripts/plot/plot_border.m @@ -23,7 +23,7 @@ ## multiplot patch ## ## Multiple arguments allowed to specify the sides on which the border -## is shown. allowed strings: +## is shown. allowed strings: ## ## allowed input strings: ## @@ -45,7 +45,7 @@ if (! gnuplot_has_multiplot) error ("plot_border: gnuplot does not appear to support this feature"); endif - + south = 0; west = 0; north = 0;
--- a/scripts/plot/polar.m +++ b/scripts/plot/polar.m @@ -24,7 +24,7 @@ ## The optional third argument specifies the line type. ## ## See also: plot, semilogx, semilogy, loglog, mesh, contour, bar, -## stairs, gplot, gsplot, replot, xlabel, ylabel, title +## stairs, gplot, gsplot, replot, xlabel, ylabel, title ## Author: jwe
--- a/scripts/plot/semilogx.m +++ b/scripts/plot/semilogx.m @@ -21,13 +21,13 @@ ## semilogx (x1, y1, x2, y2, ...) ## semilogx (x, y, fmt) ## -## Make a 2D plot of y versus x using a log scale for the x axis. +## Make a 2D plot of y versus x using a log scale for the x axis. ## ## See the help message for the plot command for a description of how -## the arguments are interpreted. +## the arguments are interpreted. ## ## See also: plot, semilogy, loglog, polar, mesh, contour, bar, stairs, -## gplot, gsplot, replot, xlabel, ylabel, title +## gplot, gsplot, replot, xlabel, ylabel, title ## Author: jwe
--- a/scripts/plot/semilogy.m +++ b/scripts/plot/semilogy.m @@ -21,13 +21,13 @@ ## semilogy (x1, y1, x2, y2, ...) ## semilogy (x, y, fmt) ## -## Make a 2D plot of y versus x using a log scale for the x axis. +## Make a 2D plot of y versus x using a log scale for the x axis. ## ## See the help message for the plot command for a description of how -## the arguments are interpreted. +## the arguments are interpreted. ## ## See also: plot, semilogx, loglog, polar, mesh, contour, bar, stairs, -## gplot, gsplot, replot, xlabel, ylabel, title +## gplot, gsplot, replot, xlabel, ylabel, title ## Author: jwe
--- a/scripts/plot/stairs.m +++ b/scripts/plot/stairs.m @@ -37,7 +37,7 @@ ## are equivalent. ## ## See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, -## bar, gplot, gsplot, replot, xlabel, ylabel, title +## bar, gplot, gsplot, replot, xlabel, ylabel, title ## Author: jwe
--- a/scripts/plot/subplot.m +++ b/scripts/plot/subplot.m @@ -64,8 +64,8 @@ ## global variables to keep track of multiplot options - global multiplot_mode - global multiplot_xsize multiplot_ysize + global multiplot_mode + global multiplot_xsize multiplot_ysize global multiplot_xn multiplot_yn global multiplot_xi multiplot_yi
--- a/scripts/plot/subwindow.m +++ b/scripts/plot/subwindow.m @@ -38,8 +38,8 @@ ## global variables to keep track of multiplot options - global multiplot_mode - global multiplot_xsize multiplot_ysize + global multiplot_mode + global multiplot_xsize multiplot_ysize global multiplot_xn multiplot_yn ## check calling argument count @@ -58,7 +58,7 @@ yn = round (yn); ## switch to multiplot mode if not already in, and use the args as the - ## args to multiplot() + ## args to multiplot() if (multiplot_mode != 1) multiplot (xn, yn); @@ -75,5 +75,5 @@ yo = (multiplot_yn - yn)*multiplot_ysize; eval (sprintf ("set origin %g, %g", xo, yo)); - + endfunction
--- a/scripts/plot/title.m +++ b/scripts/plot/title.m @@ -20,7 +20,7 @@ ## usage: title (text) ## ## Defines a title for a plot. The title will appear the next time a -## plot is displayed. +## plot is displayed. ## ## See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, ## bar, stairs, gplot, gsplot, replot, xlabel, ylabel
--- a/scripts/plot/top_title.m +++ b/scripts/plot/top_title.m @@ -22,7 +22,7 @@ ## NOTE: this will work only with gnuplot installed with ## multiplot patch ## -## makes a title with text "text" at the top of the plot +## makes a title with text "text" at the top of the plot ## Author: Vinayak Dutt <Dutt.Vinayak@mayo.EDU> ## Created: 3 July 95
--- a/scripts/polynomial/conv.m +++ b/scripts/polynomial/conv.m @@ -27,14 +27,14 @@ ## If a and b are polynomial coefficient vectors, conv returns the ## coefficients of the product polynomial. ## -## SEE ALSO: deconv, poly, roots, residue, polyval, polyderiv, polyinteg +## SEE ALSO: deconv, poly, roots, residue, polyval, polyderiv, polyinteg ## Author: Tony Richardson <amr@mpl.ucsd.edu> ## Created: June 1994 ## Adapted-By: jwe function y = conv (a, b) - + if (nargin != 2) usage ("conv(a, b)"); endif
--- a/scripts/polynomial/deconv.m +++ b/scripts/polynomial/deconv.m @@ -21,7 +21,7 @@ ## ## Deconvolve two vectors. ## -## [b, r] = deconv (y, a) solves for b and r such that +## [b, r] = deconv (y, a) solves for b and r such that ## y = conv(a,b) + r ## ## If y and a are polynomial coefficient vectors, b will contain the @@ -29,7 +29,7 @@ ## polynomial of lowest order. ## ## SEE ALSO: conv, poly, roots, residue, polyval, polyderiv, -## polyinteg +## polyinteg ## Author: Tony Richardson <amr@mpl.ucsd.edu> ## Created: June 1994
--- a/scripts/polynomial/poly.m +++ b/scripts/polynomial/poly.m @@ -19,7 +19,7 @@ ## usage: poly (x) ## -## If A is a square n-by-n matrix, poly (A) is the row vector of +## If A is a square n-by-n matrix, poly (A) is the row vector of ## the coefficients of det (z * eye(n) - A), the characteristic ## polynomial of A. ## @@ -47,15 +47,15 @@ else usage ("poly (x), where x is a vector or a square matrix"); endif - + y = zeros (1, n+1); y(1) = 1; for j = 1:n; y(2:(j+1)) = y(2:(j+1)) - v(j) .* y(1:j); endfor - + if (all (all (imag (x) == 0))) y = real (y); endif - + endfunction
--- a/scripts/polynomial/polyfit.m +++ b/scripts/polynomial/polyfit.m @@ -20,7 +20,7 @@ ## usage: polyfit (x, y, n) ## ## Returns the coefficients of a polynomial p(x) of degree n that -## minimizes sumsq (p(x(i)) - y(i)), i.e., that best fits the data +## minimizes sumsq (p(x(i)) - y(i)), i.e., that best fits the data ## in the least squares sense. ## Author: KH <Kurt.Hornik@ci.tuwien.ac.at> @@ -28,24 +28,24 @@ ## Adapted-By: jwe function p = polyfit (x, y, n) - - + + if (nargin != 3) usage ("polyfit (x, y, n)"); endif - + if (! (is_vector (x) && is_vector (y) && size (x) == size (y))) error ("polyfit: x and y must be vectors of the same size"); endif - + if (! (is_scalar (n) && n >= 0 && ! isinf (n) && n == round (n))) error ("polyfit: n must be a nonnegative integer"); endif - + l = length (x); x = reshape (x, l, 1); y = reshape (y, l, 1); - + X = ones (l, 1); if (n > 0)
--- a/scripts/polynomial/polyval.m +++ b/scripts/polynomial/polyval.m @@ -20,18 +20,18 @@ ## usage: polyval (c, x) ## ## Evaluate a polynomial. -## +## ## In octave, a polynomial is represented by it's coefficients (arranged ## in descending order). For example a vector c of length n+1 corresponds ## to the following nth order polynomial -## +## ## p(x) = c(1) x^n + ... + c(n) x + c(n+1). -## +## ## polyval(c,x) will evaluate the polynomial at the specified value of x. -## +## ## If x is a vector or matrix, the polynomial is evaluated at each of the ## elements of x. -## +## ## SEE ALSO: polyvalm, poly, roots, conv, deconv, residue, filter, ## polyderiv, polyinteg
--- a/scripts/polynomial/roots.m +++ b/scripts/polynomial/roots.m @@ -31,23 +31,23 @@ if (min (size (v)) > 1 || nargin != 1) usage ("roots (v), where v is a vector"); endif - + n = length (v); - v = reshape (v, 1, n); + v = reshape (v, 1, n); ## If v = [ 0 ... 0 v(k+1) ... v(k+l) 0 ... 0 ], we can remove the - ## leading k zeros and n - k - l roots of the polynomial are zero. + ## leading k zeros and n - k - l roots of the polynomial are zero. f = find (v); m = max (size (f)); - + if (m > 0 && n > 1) v = v(f(1):f(m)); l = max (size (v)); if (l > 1) A = diag (ones (1, l-2), -1); A(1,:) = -v(2:l) ./ v(1); - r = eig (A); + r = eig (A); if (f(m) < n) tmp = zeros (n - f(m), 1); r = [r; tmp]; @@ -58,5 +58,5 @@ else r = []; endif - + endfunction
--- a/scripts/set/create_set.m +++ b/scripts/set/create_set.m @@ -52,6 +52,6 @@ endwhile y = y(1:(yindex-1)); endif - + endfunction - +
--- a/scripts/signal/fftconv.m +++ b/scripts/signal/fftconv.m @@ -20,7 +20,7 @@ ## usage: fftconv (a, b [, N]) ## ## c = fftconv (a, b) returns the convolution of the vectors a and b, -## a vector with length equal to length (a) + length (b) - 1. +## a vector with length equal to length (a) + length (b) - 1. ## If a and b are the coefficient vectors of two polynomials, c is ## the coefficient vector of the product polynomial. ## @@ -36,7 +36,7 @@ if (nargin < 2 || nargin > 3) usage ("fftconv (b, x [, N])"); endif - + if (is_matrix (a) || is_matrix (b)) error ("fftconv: both a and b should be vectors"); endif
--- a/scripts/signal/fftfilt.m +++ b/scripts/signal/fftfilt.m @@ -32,16 +32,16 @@ function y = fftfilt (b, x, N) - ## If N is not specified explicitly, we do not use the overlap-add + ## If N is not specified explicitly, we do not use the overlap-add ## method at all because loops are really slow. Otherwise, we only ## ensure that the number of points in the FFT is the smallest power ## of two larger than N and length(b). This could result in length ## one blocks, but if the user knows better ... - + if (nargin < 2 || nargin > 3) usage (" fftfilt (b, x [, N])"); endif - + [r_x, c_x] = size (x); [r_b, c_b] = size (b); if (! (min ([r_x, c_x]) == 1 || min ([r_b, c_b]) == 1)) @@ -51,13 +51,13 @@ l_b = r_b * c_b; if ((l_x == 1) && (l_b == 1)) - y = b * x; + y = b * x; return; endif - + x = reshape (x, 1, l_x); b = reshape (b, 1, l_b); - + if (nargin == 2) ## Use FFT with the smallest power of 2 which is >= length (x) + ## length (b) - 1 as number of points ... @@ -79,9 +79,9 @@ tmp = ifft (fft (x(lo:hi), N) .* B); hi = min (lo+N-1, l_x); y(lo:hi) = y(lo:hi) + tmp(1:(hi-lo+1)); - endfor + endfor endif - + y = reshape (y(1:l_x), r_x, c_x); ## Final cleanups: if both x and b are real respectively integer, y
--- a/scripts/signal/freqz.m +++ b/scripts/signal/freqz.m @@ -56,7 +56,7 @@ elseif (nargin == 4) a = va_arg(); n = va_arg(); - region = va_arg(); + region = va_arg(); endif la = length(a); @@ -80,7 +80,7 @@ w = 2*pi*[0:(n-1)]/n; else w = pi*[0:(n-1)]/n; - endif + endif h = polyval(postpad(b,k),exp(j*w)) ./ polyval(postpad(a,k),exp(j*w)); endif
--- a/scripts/specfun/beta.m +++ b/scripts/specfun/beta.m @@ -27,7 +27,7 @@ ## Adapted-By: jwe function retval = beta (a, b) - + if (nargin != 2) usage ("beta (a, b)"); endif
--- a/scripts/specfun/betai.m +++ b/scripts/specfun/betai.m @@ -29,10 +29,10 @@ ## Adapted-By: jwe function y = betai (a, b, x) - + ## Computation is based on the series expansion - ## betai(a, b, x) - ## = \frac{1}{B(a, b)} x^a + ## betai(a, b, x) + ## = \frac{1}{B(a, b)} x^a ## \sum_{k=0}^\infty \frac{(1-b)\cdots(k-b)}{a+k} \frac{x^k}{k!} ## for x <= 1/2. For x > 1/2, betai(a, b, x) = 1 - betai(b, a, 1-x). @@ -52,7 +52,7 @@ endif if (nr > 1 || nc > 1) - + if (! (is_scalar (a) && is_scalar (b))) error ("betai: if x is not a scalar, a and b must be scalars"); endif @@ -76,18 +76,18 @@ tmp = cumprod((1 - b./k) * x(ind)) ./ ((a + k) * ones(1, len)); y(ind) = c * exp(a * log(x(ind))) .* (1/a + sum(tmp)); endif - + ind = find ((x > 1/2) & (x < 1)); len = length(ind); if (len > 0) tmp = cumprod ((1 - a./k) * (1 - x(ind))) ./ ((b + k) * ones(1, len)); y(ind) = 1 - c * exp (b * log (1-x(ind))) .* (1/b + sum (tmp)); endif - + y = reshape (y, nr, nc); - + else - + [ra, ca] = size (a); [rb, cb] = size (b); if (! (ra == rb && ca == cb)) @@ -98,7 +98,7 @@ a = reshape (a, 1, n); b = reshape (b, 1, n); c = exp (lgamma (a+b) - lgamma (a) - lgamma (b)); - + if (x == 0) y = zeros (1, n); elseif (x == 1) @@ -115,9 +115,9 @@ y = 1 - c .* exp (b * log (1-x)) .* (1 ./ b + sum (tmp)); endif endif - + y = reshape (y, ra, ca); - + endif endfunction
--- a/scripts/specfun/betainc.m +++ b/scripts/specfun/betainc.m @@ -24,7 +24,7 @@ ## Author: jwe function y = betainc (x, a, b) - + y = betai (a, b, x); endfunction
--- a/scripts/specfun/gammai.m +++ b/scripts/specfun/gammai.m @@ -21,7 +21,7 @@ ## ## Computes the incomplete gamma function ## -## gammai (a, x) +## gammai (a, x) ## = (integral from 0 to x of exp(-t) t^(a-1) dt) / gamma(a). ## ## If a is scalar, then gammai(a, x) is returned for each element of x @@ -35,20 +35,20 @@ ## Adapted-By: jwe function y = gammai (a, x) - + if (nargin != 2) usage ("gammai (a, x)"); endif - + [r_a, c_a] = size (a); [r_x, c_x] = size (x); e_a = r_a * c_a; e_x = r_x * c_x; - + ## The following code is rather ugly. We want the function to work - ## whenever a and x have the same size or a or x is scalar. + ## whenever a and x have the same size or a or x is scalar. ## We do this by reducing the latter cases to the former. - + if (e_a == 0 || e_x == 0) error ("gammai: both a and x must be nonempty"); endif @@ -71,22 +71,22 @@ r_y = r_a; c_y = c_a; else - error ("gammai: a and x must have the same size if neither is scalar"); + error ("gammai: a and x must have the same size if neither is scalar"); endif ## Now we can do sanity checking ... - + if (any (a <= 0) || any (a == Inf)) error ("gammai: all entries of a must be positive anf finite"); endif if (any (x < 0)) error ("gammai: all entries of x must be nonnegative"); endif - + y = zeros (1, n); ## For x < a + 1, use summation. The below choice of k should ensure - ## that the overall error is less than eps ... + ## that the overall error is less than eps ... S = find ((x > 0) & (x < a + 1)); s = length (S); @@ -121,9 +121,9 @@ endwhile y(S) = 1 - exp (-x(S) + a(S) .* log (x(S))) .* c_new ./ gamma (a(S)); endif - + y (find (x == Inf)) = ones (1, sum (x == Inf)); - + y = reshape (y, r_y, c_y); endfunction
--- a/scripts/specfun/gammainc.m +++ b/scripts/specfun/gammainc.m @@ -24,7 +24,7 @@ ## Author: jwe function y = gammainc (x, a) - + y = gammai (a, x); endfunction
--- a/scripts/special-matrix/hankel.m +++ b/scripts/special-matrix/hankel.m @@ -23,7 +23,7 @@ ## c, and (optionally) the last row r. ## ## If the second argument is omitted, zeros are inserted below the main -## anti-diagonal. If the last element of c is not the same as the first +## anti-diagonal. If the last element of c is not the same as the first ## element of r, the last element of c is used. ## ## See also: vander, hadamard, hilb, invhilb, toeplitz @@ -45,7 +45,7 @@ error ("hankel: expecting vector arguments"); endif - if (nargin == 1) + if (nargin == 1) r (1) = c (length (c)); endif
--- a/scripts/statistics/gls.m +++ b/scripts/statistics/gls.m @@ -38,7 +38,7 @@ ## Adapted-By: jwe function [BETA, v, R] = gls (Y, X, O) - + if (nargin != 3) usage ("[BETA, v [, R]] = gls (Y, X, O)"); endif @@ -46,7 +46,7 @@ [rx, cx] = size (X); [ry, cy] = size (Y); if (rx != ry) - error ("gls: incorrect matrix dimensions"); + error ("gls: incorrect matrix dimensions"); endif O = O^(-1/2);
--- a/scripts/strings/bin2dec.m +++ b/scripts/strings/bin2dec.m @@ -1,5 +1,5 @@ ## Copyright (C) 1996 Kurt Hornik -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ function y = bin2dec (x) ## Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. - + if (nargin != 1) usage ("bin2dec (x)"); endif @@ -39,5 +39,5 @@ else error ("bin2dec: argument must be a string of zeros and ones"); endif - + endfunction
--- a/scripts/strings/blanks.m +++ b/scripts/strings/blanks.m @@ -1,5 +1,5 @@ ## Copyright (C) 1996 Kurt Hornik -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it @@ -24,21 +24,21 @@ ## Author: jwe function s = blanks (n) - + ## Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. if (nargin != 1) usage ("blanks (n)"); endif - + if (is_scalar (n) && n > 0 && n == round (n)) s = setstr (ones (1, n) * toascii (" ")); else error ("blanks: n must be a positive integer"); endif - + endfunction - +
--- a/scripts/strings/deblank.m +++ b/scripts/strings/deblank.m @@ -1,5 +1,5 @@ ## Copyright (C) 1996 Kurt Hornik -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it @@ -24,13 +24,13 @@ ## Author: jwe function t = deblank (s) - + ## Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. if (nargin != 1) usage ("deblank (s)"); endif - + if (isstr (s)) [nr, nc] = size (s);
--- a/scripts/strings/dec2bin.m +++ b/scripts/strings/dec2bin.m @@ -1,5 +1,5 @@ ## Copyright (C) 1996 Kurt Hornik -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ function y = dec2bin (x) ## Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. - + if (nargin != 1) usage ("dec2bin (x)"); endif @@ -62,4 +62,4 @@ end_unwind_protect endfunction - +
--- a/scripts/strings/dec2hex.m +++ b/scripts/strings/dec2hex.m @@ -1,5 +1,5 @@ ## Copyright (C) 1996 Kurt Hornik -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it @@ -20,7 +20,7 @@ ## usage: dec2hex (d) ## ## Returns the hex number corresponding to the decimal number d. For -## example, dec2hex (2748) returns "abc". +## example, dec2hex (2748) returns "abc". ## Author: jwe @@ -31,7 +31,7 @@ if (nargin != 1) usage ("dec2hex (d)"); endif - + [nr, nc] = size (d); len = nr * nc;
--- a/scripts/strings/findstr.m +++ b/scripts/strings/findstr.m @@ -1,5 +1,5 @@ ## Copyright (C) 1996 Kurt Hornik -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ ## If the optional argument OVERLAP is nonzero, the returned vector ## can include overlapping positions (this is the default). ## -## For example, +## For example, ## ## findstr ("abababa", "aba") => [1, 3, 5] ## findstr ("abababa", "aba", 0) => [1, 5]
--- a/scripts/strings/index.m +++ b/scripts/strings/index.m @@ -1,5 +1,5 @@ ## Copyright (C) 1996 Kurt Hornik -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it @@ -56,5 +56,5 @@ else error ("index: expecting string arguments"); endif - + endfunction
--- a/scripts/strings/rindex.m +++ b/scripts/strings/rindex.m @@ -1,5 +1,5 @@ ## Copyright (C) 1996 Kurt Hornik -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it @@ -56,5 +56,5 @@ else error ("rindex: expecting string arguments"); endif - + endfunction
--- a/scripts/strings/split.m +++ b/scripts/strings/split.m @@ -1,5 +1,5 @@ ## Copyright (C) 1996 Kurt Hornik -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it @@ -26,22 +26,22 @@ ## Author: jwe function m = split (s, t) - + ## Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. if (nargin != 2) usage ("split (s, t)"); endif - + if (isstr (s) && isstr (t)) - + l_s = length (s); l_t = length (t); - + if (l_s < l_t) error ("split: s must not be shorter than t"); endif - + if (l_t == 0) ind = 1 : (l_s + 1); else @@ -70,7 +70,7 @@ endfor m = eval (sprintf ("str2mat (%s);", cmd)); - + else error ("split: both s and t must be strings");
--- a/scripts/strings/str2mat.m +++ b/scripts/strings/str2mat.m @@ -1,5 +1,5 @@ ## Copyright (C) 1996 Kurt Hornik -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ ## Author: jwe function m = str2mat (...) - + ## Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. if (nargin == 0) @@ -60,5 +60,5 @@ m (k, 1:tmp) = s; endif endfor - + endfunction
--- a/scripts/strings/strcmp.m +++ b/scripts/strings/strcmp.m @@ -23,11 +23,11 @@ ## ## WARNING: Unlike the C function of the same name, this function ## returns 1 for equal and zero for not equal. Why? To be compatible -## with Matlab, of course. +## with Matlab, of course. ## ## Why doesn't this always return a scalar instead of vector with ## elements corresponding to the rows of the string array? To be -## compatible with Matlab, of course. +## compatible with Matlab, of course. ## Author: jwe
--- a/scripts/strings/strrep.m +++ b/scripts/strings/strrep.m @@ -1,5 +1,5 @@ ## Copyright (C) 1995, 1996 Kurt Hornik -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it @@ -27,20 +27,20 @@ ## Adapted-By: jwe function t = strrep (s, x, y) - + if (nargin <> 3) usage ("strrep (s, x, y)"); endif - + if (! (isstr (s) && isstr (x) && isstr (y))) error ("strrep: all arguments must be strings"); endif - + if (length (x) > length (s) || isempty (x)) t = s; return; endif - + ind = findstr (s, x, 0); len = length (ind); if (len == 0) @@ -61,5 +61,5 @@ t = [t, tmp]; t = setstr (t); endif - + endfunction
--- a/scripts/strings/substr.m +++ b/scripts/strings/substr.m @@ -1,5 +1,5 @@ ## Copyright (C) 1996 Kurt Hornik -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it @@ -51,5 +51,5 @@ else error ("substr: expecting string argument"); endif - + endfunction