# HG changeset patch # User Rik # Date 1342534119 25200 # Node ID 5d3a684236b0276cc8a7dd956ca000f06f3495c1 # Parent 97ce18b62d0f14ec2cc9444557bf021a726d75f9 maint: Use Octave coding conventions for cuddling parentheses in scripts directory * lin2mu.m, loadaudio.m, wavread.m, accumarray.m, bicubic.m, celldisp.m, colon.m, cplxpair.m, dblquad.m, divergence.m, genvarname.m, gradient.m, int2str.m, interp1.m, interp1q.m, interp2.m, interpn.m, loadobj.m, nthargout.m, __isequal__.m, __splinen__.m, quadgk.m, quadl.m, quadv.m, rat.m, rot90.m, rotdim.m, saveobj.m, subsindex.m, triplequad.m, delaunay3.m, griddata.m, inpolygon.m, tsearchn.m, voronoi.m, get_first_help_sentence.m, which.m, gray2ind.m, pink.m, dlmwrite.m, strread.m, textread.m, textscan.m, housh.m, ishermitian.m, issymmetric.m, krylov.m, logm.m, null.m, rref.m, compare_versions.m, copyfile.m, dump_prefs.m, edit.m, fileparts.m, getappdata.m, isappdata.m, movefile.m, orderfields.m, parseparams.m, __xzip__.m, rmappdata.m, setappdata.m, swapbytes.m, unpack.m, ver.m, fminbnd.m, fminunc.m, fsolve.m, glpk.m, lsqnonneg.m, qp.m, sqp.m, configure_make.m, copy_files.m, describe.m, get_description.m, get_forge_pkg.m, install.m, installed_packages.m, is_architecture_dependent.m, load_package_dirs.m, print_package_description.m, rebuild.m, repackage.m, save_order.m, shell.m, allchild.m, ancestor.m, area.m, axes.m, axis.m, clabel.m, close.m, colorbar.m, comet.m, comet3.m, contour.m, cylinder.m, ezmesh.m, ezsurf.m, findobj.m, fplot.m, hist.m, isocolors.m, isonormals.m, isosurface.m, isprop.m, legend.m, mesh.m, meshz.m, pareto.m, pcolor.m, peaks.m, plot3.m, plotmatrix.m, plotyy.m, polar.m, print.m, __add_datasource__.m, __add_default_menu__.m, __axes_limits__.m, __bar__.m, __clabel__.m, __contour__.m, __errcomm__.m, __errplot__.m, __ezplot__.m, __file_filter__.m, __fltk_print__.m, __ghostscript__.m, __gnuplot_print__.m, __go_draw_axes__.m, __go_draw_figure__.m, __interp_cube__.m, __marching_cube__.m, __patch__.m, __pie__.m, __plt__.m, __print_parse_opts__.m, __quiver__.m, __scatter__.m, __stem__.m, __tight_eps_bbox__.m, __uigetdir_fltk__.m, __uigetfile_fltk__.m, __uiputfile_fltk__.m, quiver.m, quiver3.m, rectangle.m, refreshdata.m, ribbon.m, scatter.m, semilogy.m, shading.m, slice.m, subplot.m, surface.m, surfl.m, surfnorm.m, text.m, uigetfile.m, uiputfile.m, whitebg.m, deconv.m, mkpp.m, pchip.m, polyaffine.m, polyder.m, polygcd.m, polyout.m, polyval.m, ppint.m, ppjumps.m, ppval.m, residue.m, roots.m, spline.m, splinefit.m, addpref.m, getpref.m, setpref.m, ismember.m, setxor.m, arch_fit.m, arch_rnd.m, arch_test.m, autoreg_matrix.m, diffpara.m, fftconv.m, filter2.m, hanning.m, hurst.m, periodogram.m, triangle_sw.m, sinc.m, spectral_xdf.m, spencer.m, stft.m, synthesis.m, unwrap.m, yulewalker.m, bicgstab.m, gmres.m, pcg.m, pcr.m, __sprand_impl__.m, speye.m, spfun.m, sprandn.m, spstats.m, svds.m, treelayout.m, treeplot.m, bessel.m, factor.m, legendre.m, perms.m, primes.m, magic.m, toeplitz.m, corr.m, cov.m, mean.m, median.m, mode.m, qqplot.m, quantile.m, ranks.m, zscore.m, logistic_regression_likelihood.m, bartlett_test.m, chisquare_test_homogeneity.m, chisquare_test_independence.m, kolmogorov_smirnov_test.m, run_test.m, u_test.m, wilcoxon_test.m, z_test.m, z_test_2.m, bin2dec.m, dec2base.m, mat2str.m, strcat.m, strchr.m, strjust.m, strtok.m, substr.m, untabify.m, assert.m, demo.m, example.m, fail.m, speed.m, test.m, now.m: Use Octave coding conventions for cuddling parentheses in scripts directory. diff --git a/scripts/audio/lin2mu.m b/scripts/audio/lin2mu.m --- a/scripts/audio/lin2mu.m +++ b/scripts/audio/lin2mu.m @@ -62,7 +62,7 @@ endif ## Determine sign of x, set sign(0) = 1. - sig = sign(x) + (x == 0); + sig = sign (x) + (x == 0); ## Take absolute value of x, but force it to be smaller than 32636; ## add bias. diff --git a/scripts/audio/loadaudio.m b/scripts/audio/loadaudio.m --- a/scripts/audio/loadaudio.m +++ b/scripts/audio/loadaudio.m @@ -63,7 +63,7 @@ [X, c] = fread (num, inf, "short"); endif elseif (strcmp (ext, "mu") || strcmp (ext, "au") - || strcmp (ext, "snd") || strcmp(ext, "ul")) + || strcmp (ext, "snd") || strcmp (ext, "ul")) [Y, c] = fread (num, inf, "uchar"); ## remove file header m = find (Y(1:64) == 0, 1, "last"); diff --git a/scripts/audio/wavread.m b/scripts/audio/wavread.m --- a/scripts/audio/wavread.m +++ b/scripts/audio/wavread.m @@ -87,7 +87,7 @@ ## Find format chunk inside the RIFF chunk. fseek (fid, riff_pos, "bof"); fmt_size = find_chunk (fid, "fmt ", riff_size); - fmt_pos = ftell(fid); + fmt_pos = ftell (fid); if (fmt_size == -1) error ("wavread: file contains no format chunk"); endif @@ -196,7 +196,7 @@ endif if (bits_per_sample == 24) - yi = reshape (yi, 3, rows(yi)/3)'; + yi = reshape (yi, 3, rows (yi) / 3)'; yi(yi(:,3) >= 128, 3) -= 256; yi = yi * [1; 256; 65536]; endif @@ -246,5 +246,5 @@ ## Mark file as tested. Tests for wavread/wavwrite pair are in wavwrite.m. -%!assert(1) +%!assert (1) diff --git a/scripts/general/accumarray.m b/scripts/general/accumarray.m --- a/scripts/general/accumarray.m +++ b/scripts/general/accumarray.m @@ -370,7 +370,7 @@ %!assert (accumarray ([1;2;4;2;4],101:105), [101;206;0;208]) -%!assert (accumarray ([1,1,1;2,1,2;2,3,2;2,1,2;2,3,2],101:105), cat(3, [101,0,0;0,0,0],[0,0,0;206,0,208])) +%!assert (accumarray ([1,1,1;2,1,2;2,3,2;2,1,2;2,3,2],101:105), cat (3, [101,0,0;0,0,0],[0,0,0;206,0,208])) %!assert (accumarray ([1,1,1;2,1,2;2,3,2;2,1,2;2,3,2],101:105,[],@(x)sin(sum(x))), sin (cat (3, [101,0,0;0,0,0],[0,0,0;206,0,208]))) %!assert (accumarray ({[1 3 3 2 3 1 2 2 3 3 1 2],[3 4 2 1 4 3 4 2 2 4 3 4],[1 1 2 2 1 1 2 1 1 1 2 2]},101:112), cat (3, [0,0,207,0;0,108,0,0;0,109,0,317], [0,0,111,0;104,0,0,219;0,103,0,0])) %!assert (accumarray ([1,1;2,1;2,3;2,1;2,3],101:105,[2,4],@max,NaN), [101,NaN,NaN,NaN;104,NaN,105,NaN]) diff --git a/scripts/general/bicubic.m b/scripts/general/bicubic.m --- a/scripts/general/bicubic.m +++ b/scripts/general/bicubic.m @@ -38,7 +38,7 @@ print_usage (); endif - if (nargin == 7 && isscalar(spline_alpha)) + if (nargin == 7 && isscalar (spline_alpha)) a = spline_alpha; else a = 0.5; @@ -240,8 +240,8 @@ %! x = linspace (1, -1, 30); %! [xx2, yy2] = meshgrid (x); %! z1 = interp2 (xx, yy, z, xx2, yy2, "cubic"); -%! z2 = interp2 (fliplr(xx), flipud(yy), fliplr(flipud(z)), -%! fliplr(xx2), flipud(yy2), "cubic"); +%! z2 = interp2 (fliplr (xx), flipud (yy), fliplr (flipud(z)), +%! fliplr (xx2), flipud (yy2), "cubic"); %! z2 = fliplr (flipud (z2)); %! assert (z1, z2, 100 * eps ()) diff --git a/scripts/general/celldisp.m b/scripts/general/celldisp.m --- a/scripts/general/celldisp.m +++ b/scripts/general/celldisp.m @@ -71,10 +71,10 @@ if (sum (dv != 1) > 1) c = cell (size (dv)); [c{:}] = ind2sub (dv, i); - s = sprintf("%i,", c{:}); + s = sprintf ("%i,", c{:}); s(end) = []; else - s = sprintf("%i", i); + s = sprintf ("%i", i); endif endfunction diff --git a/scripts/general/colon.m b/scripts/general/colon.m --- a/scripts/general/colon.m +++ b/scripts/general/colon.m @@ -35,7 +35,7 @@ function r = colon (varargin) if (nargin != 0) - error ("colon: not defined for class \"%s\"", class(varargin{1})); + error ("colon: not defined for class \"%s\"", class (varargin{1})); endif endfunction diff --git a/scripts/general/cplxpair.m b/scripts/general/cplxpair.m --- a/scripts/general/cplxpair.m +++ b/scripts/general/cplxpair.m @@ -44,9 +44,9 @@ ## @end deftypefn ## FIXME: subsort returned pairs by imaginary magnitude -## FIXME: Why doesn't exp(2i*pi*[0:4]'/5) produce exact conjugates. Does -## FIXME: it in Matlab? The reason is that complex pairs are supposed -## FIXME: to be exact conjugates, and not rely on a tolerance test. +## FIXME: Why doesn't exp (2i*pi*[0:4]'/5) produce exact conjugates. Does +## FIXME: it in Matlab? The reason is that complex pairs are supposed +## FIXME: to be exact conjugates, and not rely on a tolerance test. ## 2006-05-12 David Bateman - Modified for NDArrays @@ -82,7 +82,7 @@ dim = 1; endif else - dim = floor(dim); + dim = floor (dim); if (dim < 1 || dim > nd) error ("cplxpair: invalid dimension along which to sort"); endif @@ -105,7 +105,7 @@ if (isa (z, "single")) cls = "single"; endif - [idxi, idxj] = find (abs (imag (z)) ./ (abs (z) + realmin(cls)) < tol); + [idxi, idxj] = find (abs (imag (z)) ./ (abs (z) + realmin (cls)) < tol); q = sparse (idxi, idxj, 1, n, m); nr = sum (q, 1); [q, idx] = sort (q, 1); diff --git a/scripts/general/dblquad.m b/scripts/general/dblquad.m --- a/scripts/general/dblquad.m +++ b/scripts/general/dblquad.m @@ -67,7 +67,7 @@ endfunction function q = __dblquad_inner__ (y, f, xa, xb, tol, quadf, varargin) - q = zeros (size(y)); + q = zeros (size (y)); for i = 1 : length (y) q(i) = feval (quadf, @(x) f(x, y(i), varargin{:}), xa, xb, tol); endfor diff --git a/scripts/general/divergence.m b/scripts/general/divergence.m --- a/scripts/general/divergence.m +++ b/scripts/general/divergence.m @@ -81,8 +81,8 @@ error ("divergence: size of dx and dy must match the respective dimension of X and Y"); endif - retval = gradient(varargin{fidx}, dx, dy); - retval += gradient(varargin{fidx + 1}.', dy, dx).'; + retval = gradient (varargin{fidx}, dx, dy); + retval += gradient (varargin{fidx + 1}.', dy, dx).'; elseif ((nargin == 6) || (nargin == 3)) if (!size_equal (varargin{fidx},varargin{fidx + 1},varargin{fidx + 2})) diff --git a/scripts/general/genvarname.m b/scripts/general/genvarname.m --- a/scripts/general/genvarname.m +++ b/scripts/general/genvarname.m @@ -160,7 +160,7 @@ idx = 0; while (excluded) idx++; - varname{i} = sprintf("%s%d", str{i}, idx); + varname{i} = sprintf ("%s%d", str{i}, idx); excluded = any (strcmp (varname{i}, exclusions)); endwhile exclusions(end+1) = varname(i); diff --git a/scripts/general/gradient.m b/scripts/general/gradient.m --- a/scripts/general/gradient.m +++ b/scripts/general/gradient.m @@ -70,12 +70,12 @@ print_usage (); endif - nargout_with_ans = max(1,nargout); + nargout_with_ans = max (1,nargout); if (ismatrix (m)) [varargout{1:nargout_with_ans}] = matrix_gradient (m, varargin{:}); elseif (isa (m, "function_handle")) [varargout{1:nargout_with_ans}] = handle_gradient (m, varargin{:}); - elseif (ischar(m)) + elseif (ischar (m)) [varargout{1:nargout_with_ans}] = handle_gradient (str2func (m), varargin{:}); else error ("gradient: first input must be an array or a function"); @@ -93,7 +93,7 @@ nd = ndims (m); sz = size (m); - if (length(sz) > 1) + if (length (sz) > 1) tmp = sz(1); sz(1) = sz(2); sz(2) = tmp; endif @@ -281,7 +281,7 @@ %! assert (all (dY(:) == 0)); %! assert (all (dZ(:) == 0)); %! assert (all (dU(:) == 5)); -%! assert (size_equal(dX, dY, dZ, dU, X, Y, Z, U)); +%! assert (size_equal (dX, dY, dZ, dU, X, Y, Z, U)); %! [dX,dY,dZ,dU] = gradient (U, 5.0); %! assert (all (dU(:) == 1)); %! [dX,dY,dZ,dU] = gradient (U, 1.0, 2.0, 3.0, 2.5); diff --git a/scripts/general/int2str.m b/scripts/general/int2str.m --- a/scripts/general/int2str.m +++ b/scripts/general/int2str.m @@ -57,8 +57,8 @@ return; endif - n = round (real(n)); - sz = size(n); + n = round (real (n)); + sz = size (n); nd = ndims (n); nc = columns (n); if (nc > 1) diff --git a/scripts/general/interp1.m b/scripts/general/interp1.m --- a/scripts/general/interp1.m +++ b/scripts/general/interp1.m @@ -141,7 +141,7 @@ if (isempty (xi) && firstnumeric && ! ispp) xi = y; y = x; - x = 1:numel(y); + x = 1:numel (y); endif ## reshape matrices for convenience @@ -204,7 +204,7 @@ if (ispp) yi = pp; else - yi = ppval(pp, reshape (xi, szx)); + yi = ppval (pp, reshape (xi, szx)); endif case "linear" dy = diff (y); @@ -225,7 +225,7 @@ if (ispp) yi = pp; else - yi = ppval(pp, reshape (xi, szx)); + yi = ppval (pp, reshape (xi, szx)); endif case "*linear" @@ -237,7 +237,7 @@ if (ispp) yi = pp; else - yi = ppval(pp, reshape (xi, szx)); + yi = ppval (pp, reshape (xi, szx)); endif case {"pchip", "*pchip", "cubic", "*cubic"} @@ -258,7 +258,7 @@ endif case {"spline", "*spline"} if (nx == 2 || starmethod) - x = linspace(x(1), x(nx), ny); + x = linspace (x(1), x(nx), ny); endif if (ispp) diff --git a/scripts/general/interp1q.m b/scripts/general/interp1q.m --- a/scripts/general/interp1q.m +++ b/scripts/general/interp1q.m @@ -59,7 +59,7 @@ %!shared xp, yp, xi, yi -%! xp = [0:2:10].'; yp = sin(2*pi*xp/5); +%! xp = [0:2:10].'; yp = sin (2*pi*xp/5); %! xi = [-1; 0; 2.2; 4; 6.6; 10; 11]; %! yi = interp1 (xp,yp,xi); %!assert (interp1q (xp,yp, [min(xp)-1; max(xp)+1]), [NA; NA]); diff --git a/scripts/general/interp2.m b/scripts/general/interp2.m --- a/scripts/general/interp2.m +++ b/scripts/general/interp2.m @@ -377,7 +377,7 @@ AX_2 = bc ((XI - K - 2)); ## Perform interpolation - sz = size(Z); + sz = size (Z); ZI = AY_2 .* AX_2 .* Z (sym_sub2ind (sz, L+2, K+2)) ... + AY_2 .* AX_1 .* Z (sym_sub2ind (sz, L+2, K+1)) ... + AY_2 .* AX0 .* Z (sym_sub2ind (sz, L+2, K)) ... @@ -420,9 +420,9 @@ endfunction ## Compute the bicubic interpolation coefficients -function o = bc(x) - x = abs(x); - o = zeros(size(x)); +function o = bc (x) + x = abs (x); + o = zeros (size (x)); idx1 = (x < 1); idx2 = !idx1 & (x < 2); o(idx1) = 1 - 2.*x(idx1).^2 + x(idx1).^3; @@ -430,7 +430,7 @@ endfunction ## This version of sub2ind behaves as if the data was symmetrically padded -function ind = sym_sub2ind(sz, Y, X) +function ind = sym_sub2ind (sz, Y, X) Y (Y < 1) = 1 - Y (Y < 1); while (any (Y (:) > 2 * sz (1))) Y (Y > 2 * sz (1)) = round (Y (Y > 2 * sz (1)) / 2); @@ -441,7 +441,7 @@ X (X > 2 * sz (2)) = round (X (X > 2 * sz (2)) / 2); endwhile X (X > sz (2)) = 1 + 2 * sz (2) - X (X > sz (2)); - ind = sub2ind(sz, Y, X); + ind = sub2ind (sz, Y, X); endfunction diff --git a/scripts/general/interpn.m b/scripts/general/interpn.m --- a/scripts/general/interpn.m +++ b/scripts/general/interpn.m @@ -198,8 +198,8 @@ q(:) = i; idx {i} = q; endfor - vi = vi (cellfun (@(x) sub2ind (size(vi), x{:}), idx)); - vi = reshape (vi, size(y{1})); + vi = vi (cellfun (@(x) sub2ind (size (vi), x{:}), idx)); + vi = reshape (vi, size (y{1})); endif elseif (strcmp (method, "cubic")) error ("interpn: cubic interpolation not yet implemented"); diff --git a/scripts/general/loadobj.m b/scripts/general/loadobj.m --- a/scripts/general/loadobj.m +++ b/scripts/general/loadobj.m @@ -37,5 +37,5 @@ ## @end deftypefn function b = loadobj (a) - error ("loadobj: not defined for class \"%s\"", class(a)); + error ("loadobj: not defined for class \"%s\"", class (a)); endfunction diff --git a/scripts/general/nthargout.m b/scripts/general/nthargout.m --- a/scripts/general/nthargout.m +++ b/scripts/general/nthargout.m @@ -34,7 +34,7 @@ ## @example ## @group ## @var{m} = magic (5); -## cell2mat (nthargout ([1, 2], @@ind2sub, size(@var{m}), +## cell2mat (nthargout ([1, 2], @@ind2sub, size (@var{m}), ## nthargout (2, @@max, @var{m}(:)))) ## @result{} 5 3 ## @end group @@ -45,7 +45,7 @@ ## ## @example ## @group -## @var{m} = magic(5); +## @var{m} = magic (5); ## [~, idx] = max (@var{M}(:)); ## [i, j] = ind2sub (size (@var{m}), idx); ## [i, j] diff --git a/scripts/general/private/__isequal__.m b/scripts/general/private/__isequal__.m --- a/scripts/general/private/__isequal__.m +++ b/scripts/general/private/__isequal__.m @@ -58,7 +58,7 @@ ## All arguments must either be of the same class or they must be ## numeric values. - t = (all (strcmp (class(x), + t = (all (strcmp (class (x), cellfun ("class", varargin, "uniformoutput", false))) || ((isnumeric (x) || islogical (x)) && all (cellfun ("isnumeric", varargin) diff --git a/scripts/general/private/__splinen__.m b/scripts/general/private/__splinen__.m --- a/scripts/general/private/__splinen__.m +++ b/scripts/general/private/__splinen__.m @@ -31,18 +31,18 @@ endif ## ND isvector function. isvec = @(x) numel (x) == length (x); - if (!iscell (x) || length(x) < ndims(y) || any (! cellfun (isvec, x)) - || !iscell (xi) || length(xi) < ndims(y) || any (! cellfun (isvec, xi))) + if (!iscell (x) || length (x) < ndims (y) || any (! cellfun (isvec, x)) + || !iscell (xi) || length (xi) < ndims (y) || any (! cellfun (isvec, xi))) error ("__splinen__: %s: non gridded data or dimensions inconsistent", f); endif yi = y; - for i = length(x):-1:1 + for i = length (x):-1:1 yi = permute (spline (x{i}, yi, xi{i}(:)), [length(x),1:length(x)-1]); endfor [xi{:}] = ndgrid (cellfun (@(x) x(:), xi, "uniformoutput", false){:}); - idx = zeros (size(xi{1})); - for i = 1 : length(x) + idx = zeros (size (xi{1})); + for i = 1 : length (x) idx |= xi{i} < min (x{i}(:)) | xi{i} > max (x{i}(:)); endfor yi(idx) = extrapval; diff --git a/scripts/general/quadgk.m b/scripts/general/quadgk.m --- a/scripts/general/quadgk.m +++ b/scripts/general/quadgk.m @@ -162,7 +162,7 @@ abstol = varargin{idx++}; elseif (strcmpi (str, "waypoints")) waypoints = varargin{idx++} (:); - if (isreal(waypoints)) + if (isreal (waypoints)) waypoints (waypoints < a | waypoints > b) = []; endif elseif (strcmpi (str, "maxintervalcount")) @@ -190,13 +190,13 @@ ## Use variable subsitution to weaken endpoint singularities and to ## perform integration with endpoints at infinity. No transform for ## contour integrals - if (iscomplex (a) || iscomplex (b) || iscomplex(waypoints)) + if (iscomplex (a) || iscomplex (b) || iscomplex (waypoints)) ## contour integral, no transform subs = [a; waypoints; b]; h = sum (abs (diff (subs))); h0 = h; trans = @(t) t; - elseif (isinf (a) && isinf(b)) + elseif (isinf (a) && isinf (b)) ## Standard Infinite to finite integral transformation. ## \int_{-\infinity_^\infinity f(x) dx = \int_-1^1 f (g(t)) g'(t) dt ## where @@ -205,7 +205,7 @@ ## waypoint transform is then ## t = (2 * g(t)) ./ (1 + sqrt(1 + 4 * g(t) .^ 2)) if (!isempty (waypoints)) - trans = @(x) (2 * x) ./ (1 + sqrt(1 + 4 * x .^ 2)); + trans = @(x) (2 * x) ./ (1 + sqrt (1 + 4 * x .^ 2)); subs = [-1; trans(waypoints); 1]; else subs = linspace (-1, 1, 11)'; @@ -240,7 +240,7 @@ h0 = b - a; trans = @(t) b - (t ./ (1 + t)).^2; f = @(s) - 2 * s .* f (b - (s ./ (1 + s)) .^ 2) ./ ((1 + s) .^ 3); - elseif (isinf(b)) + elseif (isinf (b)) ## Formula defined in Shampine paper as two separate steps. One to ## weaken singularity at finite end, then a second to transform to ## a finite interval. The singularity weakening transform is @@ -281,7 +281,7 @@ trans = @__quadgk_finite_waypoint__; subs = [-1; trans(waypoints, a, b); 1]; else - subs = linspace(-1, 1, 11)'; + subs = linspace (-1, 1, 11)'; endif h = 2; h0 = b - a; @@ -343,7 +343,7 @@ endif ## Accept the subintervals that meet the convergence criteria - idx = find (abs (q_errs) < tol .* abs(diff (subs, [], 2)) ./ h); + idx = find (abs (q_errs) < tol .* abs (diff (subs, [], 2)) ./ h); if (first) q = sum (q_subs (idx)); err = sum (q_errs(idx)); @@ -362,7 +362,7 @@ endif if (trace) - disp([rows(subs), err, q0]); + disp ([rows(subs), err, q0]); endif ## Split remaining subintervals in two @@ -382,7 +382,7 @@ [q_subs, q_errs] = __quadgk_eval__ (f, subs); endwhile - if (err > max (abstol, reltol * abs(q))) + if (err > max (abstol, reltol * abs (q))) warning ("quadgk: Error tolerance not met. Estimated error %g", err); endif unwind_protect_cleanup @@ -425,7 +425,7 @@ halfwidth = diff (subs, [], 2) ./ 2; center = sum (subs, 2) ./ 2;; x = bsxfun (@plus, halfwidth * abscissa, center); - y = reshape (f (x(:)), size(x)); + y = reshape (f (x(:)), size (x)); ## This is faster than using bsxfun as the * operator can use a ## single BLAS call, rather than rows(sub) calls to the @times @@ -436,7 +436,7 @@ function t = __quadgk_finite_waypoint__ (x, a, b) c = (-4 .* x + 2.* (b + a)) ./ (b - a); - k = ((sqrt(c .^ 2 - 4) + c) ./ 2) .^ (1/3); + k = ((sqrt (c .^ 2 - 4) + c) ./ 2) .^ (1/3); t = real ((sqrt(3) .* 1i * (1 - k .^ 2) - (1 + k .^ 2)) ./ 2 ./ k); endfunction diff --git a/scripts/general/quadl.m b/scripts/general/quadl.m --- a/scripts/general/quadl.m +++ b/scripts/general/quadl.m @@ -136,7 +136,7 @@ if (R > 0 && R < 1) tol = tol/R; endif - is = s * abs(is) * tol/myeps; + is = s * abs (is) * tol/myeps; if (is == 0) is = b-a; endif @@ -162,7 +162,7 @@ h = (b-a)/2; m = (a+b)/2; alpha = sqrt (2/3); - beta = 1 / sqrt(5); + beta = 1 / sqrt (5); mll = m-alpha*h; ml = m-beta*h; mr = m+beta*h; diff --git a/scripts/general/quadv.m b/scripts/general/quadv.m --- a/scripts/general/quadv.m +++ b/scripts/general/quadv.m @@ -153,7 +153,7 @@ %!assert (quadv (@sin, 0, pi), 2, 1e-5) %% Handles weak singularities at the edge -%!assert (quadv (@(x) 1 ./ sqrt(x), 0, 1), 2, 1e-5) +%!assert (quadv (@(x) 1 ./ sqrt (x), 0, 1), 2, 1e-5) %% Handles vector-valued functions %!assert (quadv (@(x) [(sin (x)), (sin (2 * x))], 0, pi), [2, 0], 1e-5) diff --git a/scripts/general/rat.m b/scripts/general/rat.m --- a/scripts/general/rat.m +++ b/scripts/general/rat.m @@ -36,7 +36,7 @@ ## @seealso{rats} ## @end deftypefn -function [n,d] = rat(x,tol) +function [n,d] = rat (x,tol) if (nargin != [1,2] || nargout > 2) print_usage (); @@ -49,27 +49,27 @@ ## default norm if (nargin < 2) - tol = 1e-6 * norm(y,1); + tol = 1e-6 * norm (y,1); endif ## First step in the approximation is the integer portion ## First element in the continued fraction. - n = round(y); - d = ones(size(y)); + n = round (y); + d = ones (size (y)); frac = y-n; - lastn = ones(size(y)); - lastd = zeros(size(y)); + lastn = ones (size (y)); + lastd = zeros (size (y)); - nd = ndims(y); + nd = ndims (y); nsz = numel (y); - steps = zeros([nsz, 0]); + steps = zeros ([nsz, 0]); ## Grab new factors until all continued fractions converge. while (1) ## Determine which fractions have not yet converged. - idx = find(abs (y-n./d) >= tol); - if (isempty(idx)) + idx = find (abs (y-n./d) >= tol); + if (isempty (idx)) if (isempty (steps)) steps = NaN (nsz, 1); endif @@ -79,7 +79,7 @@ ## Grab the next step in the continued fraction. flip = 1./frac(idx); ## Next element in the continued fraction. - step = round(flip); + step = round (flip); if (nargout < 2) tsteps = NaN (nsz, 1); @@ -100,23 +100,23 @@ if (nargout == 2) ## Move the minus sign to the top. - n = n.*sign(d); - d = abs(d); + n = n .* sign (d); + d = abs (d); ## Return the same shape as you receive. - n = reshape(n, size(x)); - d = reshape(d, size(x)); + n = reshape (n, size (x)); + d = reshape (d, size (x)); ## Use 1/0 for Inf. - n(isinf(x)) = sign(x(isinf(x))); - d(isinf(x)) = 0; + n(isinf (x)) = sign (x(isinf (x))); + d(isinf (x)) = 0; ## Reshape the output. n = reshape (n, size (x)); d = reshape (d, size (x)); else n = ""; - nsteps = size(steps, 2); + nsteps = size (steps, 2); for i = 1: nsz s = [int2str(y(i))," "]; j = 1; diff --git a/scripts/general/rot90.m b/scripts/general/rot90.m --- a/scripts/general/rot90.m +++ b/scripts/general/rot90.m @@ -87,17 +87,17 @@ %! x3 = [4, 3; 2, 1]; %! x4 = [3, 1; 4, 2]; %! -%! assert(rot90 (x1), x2); -%! assert(rot90 (x1, 2), x3); -%! assert(rot90 (x1, 3), x4); -%! assert(rot90 (x1, 4), x1); -%! assert(rot90 (x1, 5), x2); -%! assert(rot90 (x1, -1), x4); +%! assert (rot90 (x1), x2); +%! assert (rot90 (x1, 2), x3); +%! assert (rot90 (x1, 3), x4); +%! assert (rot90 (x1, 4), x1); +%! assert (rot90 (x1, 5), x2); +%! assert (rot90 (x1, -1), x4); %% Test input validation %!error rot90 () %!error rot90 (1, 2, 3) -%!error rot90 (1, ones(2)) +%!error rot90 (1, ones (2)) %!error rot90 (1, 1.5) %!error rot90 (1, 1+i) diff --git a/scripts/general/rotdim.m b/scripts/general/rotdim.m --- a/scripts/general/rotdim.m +++ b/scripts/general/rotdim.m @@ -60,8 +60,8 @@ print_usage (); endif - if (nargin > 1 && ! isempty(n)) - if (!isscalar (n) || !isreal(n) || fix (n) != n) + if (nargin > 1 && ! isempty (n)) + if (!isscalar (n) || !isreal (n) || fix (n) != n) error ("rotdim: N must be a scalar integer"); endif else diff --git a/scripts/general/saveobj.m b/scripts/general/saveobj.m --- a/scripts/general/saveobj.m +++ b/scripts/general/saveobj.m @@ -40,5 +40,5 @@ ## @end deftypefn function b = saveobj (a) - error ("saveobj: not defined for class \"%s\"", class(a)); + error ("saveobj: not defined for class \"%s\"", class (a)); endfunction diff --git a/scripts/general/subsindex.m b/scripts/general/subsindex.m --- a/scripts/general/subsindex.m +++ b/scripts/general/subsindex.m @@ -60,6 +60,6 @@ ## @end deftypefn function idx = subsindex (a) - error ("subsindex: not defined for class \"%s\"", class(a)); + error ("subsindex: not defined for class \"%s\"", class (a)); endfunction diff --git a/scripts/general/triplequad.m b/scripts/general/triplequad.m --- a/scripts/general/triplequad.m +++ b/scripts/general/triplequad.m @@ -69,7 +69,7 @@ endfunction function q = __triplequad_inner__ (y, z, f, xa, xb, tol, quadf, varargin) - q = zeros (size(y)); + q = zeros (size (y)); for i = 1 : length (y) q(i) = feval (quadf, @(x) f (x, y(i), z, varargin{:}), xa, xb, tol); endfor diff --git a/scripts/geometry/delaunay3.m b/scripts/geometry/delaunay3.m --- a/scripts/geometry/delaunay3.m +++ b/scripts/geometry/delaunay3.m @@ -54,7 +54,7 @@ endif if (! (isvector (x) && isvector (y) && isvector (z) - && length (x) == length (y) && length(x) == length (z))) + && length (x) == length (y) && length (x) == length (z))) error ("delaunay: X, Y, and Z must be the same size"); elseif (nargin == 4 && ! (ischar (options) || iscellstr (options))) error ("delaunay3: OPTIONS must be a string or cell array of strings"); diff --git a/scripts/geometry/griddata.m b/scripts/geometry/griddata.m --- a/scripts/geometry/griddata.m +++ b/scripts/geometry/griddata.m @@ -178,9 +178,9 @@ %!testif HAVE_QHULL %! [xx,yy] = meshgrid (linspace (-1,1,32)); %! x = xx(:); -%! x = x + 10*(2*round (rand (size(x))) - 1) * eps; +%! x = x + 10*(2*round (rand (size (x))) - 1) * eps; %! y = yy(:); -%! y = y + 10*(2*round (rand (size(y))) - 1) * eps; +%! y = y + 10*(2*round (rand (size (y))) - 1) * eps; %! z = sin (2*(x.^2 + y.^2)); %! zz = griddata (x,y,z,xx,yy,"linear"); %! zz2 = sin (2*(xx.^2 + yy.^2)); diff --git a/scripts/geometry/inpolygon.m b/scripts/geometry/inpolygon.m --- a/scripts/geometry/inpolygon.m +++ b/scripts/geometry/inpolygon.m @@ -54,9 +54,9 @@ npol = length (xv); do_boundary = (nargout >= 2); - in = zeros (size(x), "logical"); + in = zeros (size (x), "logical"); if (do_boundary) - on = zeros (size(x), "logical"); + on = zeros (size (x), "logical"); endif j = npol; diff --git a/scripts/geometry/tsearchn.m b/scripts/geometry/tsearchn.m --- a/scripts/geometry/tsearchn.m +++ b/scripts/geometry/tsearchn.m @@ -44,8 +44,8 @@ b = cart2bary (x (t (i, :), :), xi(ni,:)); ## Our points xi are in the current triangle if - ## (all(b >= 0) && all (b <= 1)). However as we impose that - ## sum(b,2) == 1 we only need to test all(b>=0). Note need to add + ## (all (b >= 0) && all (b <= 1)). However as we impose that + ## sum (b,2) == 1 we only need to test all(b>=0). Note need to add ## a small margin for rounding errors intri = all (b >= -1e-12, 2); idx(ni(intri)) = i; @@ -69,17 +69,17 @@ ## ## and therefore we can write the above as ## - ## P - T(end, :) = Beta(1:end-1) * (T(1:end-1,:) - ones(N,1) * T(end,:)) + ## P - T(end, :) = Beta(1:end-1) * (T(1:end-1,:) - ones (N,1) * T(end,:)) ## ## and then we can solve for Beta as ## - ## Beta(1:end-1) = (P - T(end,:)) / (T(1:end-1,:) - ones(N,1) * T(end,:)) - ## Beta(end) = sum(Beta) + ## Beta(1:end-1) = (P - T(end,:)) / (T(1:end-1,:) - ones (N,1) * T(end,:)) + ## Beta(end) = sum (Beta) ## ## Note below is generalize for multiple values of P, one per row. [M, N] = size (P); - Beta = (P - ones (M,1) * T(end,:)) / (T(1:end-1,:) - ones(N,1) * T(end,:)); - Beta (:,end+1) = 1 - sum(Beta, 2); + Beta = (P - ones (M,1) * T(end,:)) / (T(1:end-1,:) - ones (N,1) * T(end,:)); + Beta (:,end+1) = 1 - sum (Beta, 2); endfunction diff --git a/scripts/geometry/voronoi.m b/scripts/geometry/voronoi.m --- a/scripts/geometry/voronoi.m +++ b/scripts/geometry/voronoi.m @@ -37,7 +37,7 @@ ## ## If a single output argument is requested then the Voronoi diagram will be ## plotted and a graphics handle @var{h} to the plot is returned. -## [@var{vx}, @var{vy}] = voronoi(@dots{}) returns the Voronoi vertices +## [@var{vx}, @var{vy}] = voronoi (@dots{}) returns the Voronoi vertices ## instead of plotting the diagram. ## ## @example @@ -146,7 +146,7 @@ edges(2, 1 :end - 1) != edges(2, 2 : end)), true]); ## Eliminate the edges of the diagram representing the box - poutside = (1 : rows(p)) ... + poutside = (1 : rows (p)) ... (p (:, 1) < xmin - xdelta | p (:, 1) > xmax + xdelta | ... p (:, 2) < ymin - ydelta | p (:, 2) > ymax + ydelta); edgeoutside = ismember (edges (1, :), poutside) & ... @@ -180,8 +180,8 @@ %! phi = linspace (-pi, 3/4*pi, 8); %! [x,y] = pol2cart (phi, 1); %! [vx,vy] = voronoi (x,y); -%! assert(vx(2,:), zeros (1, columns (vx)), eps); -%! assert(vy(2,:), zeros (1, columns (vy)), eps); +%! assert (vx(2,:), zeros (1, columns (vx)), eps); +%! assert (vy(2,:), zeros (1, columns (vy)), eps); %% FIXME: Need input validation tests diff --git a/scripts/help/get_first_help_sentence.m b/scripts/help/get_first_help_sentence.m --- a/scripts/help/get_first_help_sentence.m +++ b/scripts/help/get_first_help_sentence.m @@ -105,11 +105,11 @@ if (! isempty (def_idx)) endl_idx = find (help_text == "\n"); for k = 1:length (def_idx) - endl = endl_idx (find (endl_idx > def_idx(k), 1)); + endl = endl_idx(find (endl_idx > def_idx(k), 1)); if (isempty (endl)) - keep (def_idx(k) : end) = false; + keep(def_idx(k):end) = false; else - keep (def_idx(k) : endl) = false; + keep(def_idx(k):endl) = false; endif endfor diff --git a/scripts/help/which.m b/scripts/help/which.m --- a/scripts/help/which.m +++ b/scripts/help/which.m @@ -57,7 +57,7 @@ %!test %! str = which ("ls"); -%! assert (str(end-17:end), strcat ("miscellaneous", filesep(), "ls.m")); +%! assert (str(end-17:end), strcat ("miscellaneous", filesep (), "ls.m")); %!test %! str = which ("dot"); %! assert (str(end-6:end), "dot.oct"); diff --git a/scripts/image/gray2ind.m b/scripts/image/gray2ind.m --- a/scripts/image/gray2ind.m +++ b/scripts/image/gray2ind.m @@ -35,7 +35,7 @@ if (nargin < 1 || nargin > 2) print_usage (); endif - C = class(I); + C = class (I); if (! ismatrix (I) || ndims (I) != 2) error ("gray2ind: first input argument must be a gray scale image"); endif diff --git a/scripts/image/pink.m b/scripts/image/pink.m --- a/scripts/image/pink.m +++ b/scripts/image/pink.m @@ -44,7 +44,7 @@ endif if (n == 1) - map = sqrt([1/3, 1/3, 1/3]); + map = sqrt ([1/3, 1/3, 1/3]); elseif (n > 1) x = linspace (0, 1, n)'; r = (x < 3/8) .* (14/9 * x) ... diff --git a/scripts/io/dlmwrite.m b/scripts/io/dlmwrite.m --- a/scripts/io/dlmwrite.m +++ b/scripts/io/dlmwrite.m @@ -180,7 +180,7 @@ endif if (iscomplex (M)) M = M.'; - b = zeros (2*rows(M), columns (M)); + b = zeros (2*rows (M), columns (M)); b(1: 2 : end, :) = real (M); b(2: 2 : end, :) = imag (M); fprintf (fid, template, b); diff --git a/scripts/io/strread.m b/scripts/io/strread.m --- a/scripts/io/strread.m +++ b/scripts/io/strread.m @@ -564,7 +564,7 @@ while (ii <= num_words_per_line) ## Check if fmt_words(ii) contains a literal or fixed-width - if ((idf(ii) || idg(ii)) && (rows(words) < num_words_per_line)) + if ((idf(ii) || idg(ii)) && (rows (words) < num_words_per_line)) if (idf(ii)) s = strfind (words(icol, 1), fmt_words{ii}); if (isempty (s{:})) @@ -583,11 +583,11 @@ if (! idg(ii) && ! isempty (s) && s(1) == 1) ## Leading literal. Assign literal to icol, paste rest in icol + 1 ## Apply only to those cells that do have something beyond literal - jptr = find (cellfun("length", words(icol+1, jptr), ... - "UniformOutput", false) > e(1)); + jptr = find (cellfun ("length", words(icol+1, jptr), ... + "UniformOutput", false) > e(1)); words(icol+1, :) = {""}; words(icol+1, jptr) = cellfun ... - (@(x) substr(x, e(1)+1, length(x)-e(1)), words(icol, jptr), ... + (@(x) substr (x, e(1)+1, length (x) - e(1)), words(icol, jptr), ... "UniformOutput", false); words(icol, jptr) = fmt_words{ii}; fwptr = [fwptr(1:ii) (++fwptr(ii+1:end))]; @@ -617,14 +617,14 @@ wrds(1:2:2*numel (words(icol, jptr))) = ... strrep (words(icol, jptr), fmt_words{ii}, ... [char(255) char(254)]); - wrds(2:2:2*numel (words(icol, jptr))-1) = char(255); - wrds = strsplit ([wrds{:}], char(255)); + wrds(2:2:2*numel (words(icol, jptr))-1) = char (255); + wrds = strsplit ([wrds{:}], char (255)); words(icol, jptr) = ... - wrds(find (cellfun ("isempty", strfind (wrds, char(254))))); - wrds(find (cellfun ("isempty", strfind (wrds, char(254))))) ... - = char(255); + wrds(find (cellfun ("isempty", strfind (wrds, char (254))))); + wrds(find (cellfun ("isempty", strfind (wrds, char (254))))) ... + = char (255); words(icol+1, jptr) = strsplit (strrep ([wrds{2:end}], ... - char(254), fmt_words{ii}), char(255)); + char (254), fmt_words{ii}), char (255)); ## Former trailing literal may now be leading for next specifier --ii; fwptr = [fwptr(1:ii) (++fwptr(ii+1:end))]; @@ -762,7 +762,7 @@ ## to avoid it being included in consecutive delim series enchr = ' '; ## However watch out if eol_char is also in delimiters - if (index (sep, eol_char)); enchr = char(255); endif + if (index (sep, eol_char)); enchr = char (255); endif text = strrep (text, eol_char, [enchr eol_char enchr]); else mult_dlms_s1 = false; @@ -770,7 +770,7 @@ ## Split text string along delimiters out = strsplit (text, sep, mult_dlms_s1); - if (index (sep, eol_char)); out = strrep (out, char(255), ''); endif + if (index (sep, eol_char)); out = strrep (out, char (255), ''); endif ## In case of trailing delimiter, strip stray last empty word if (!isempty (out) && any (sep == text(end))) out(end) = []; diff --git a/scripts/io/textread.m b/scripts/io/textread.m --- a/scripts/io/textread.m +++ b/scripts/io/textread.m @@ -150,7 +150,7 @@ str = fscanf (fid, "%c", eoi_pos); else fseek (fid, st_pos, "bof"); - str = fread(fid, "char=>char").'; + str = fread (fid, "char=>char").'; endif fclose (fid); diff --git a/scripts/io/textscan.m b/scripts/io/textscan.m --- a/scripts/io/textscan.m +++ b/scripts/io/textscan.m @@ -332,7 +332,7 @@ %!test %! str = "13, 72, NA, str1, 25\r\n// Middle line\r\n36, na, 05, str3, 6"; %! a = textscan (str, "%d %n %f %s %n", "delimiter", ",","treatAsEmpty", {"NA", "na"},"commentStyle", "//"); -%! assert (a{1}, int32([13; 36])); +%! assert (a{1}, int32 ([13; 36])); %! assert (a{2}, [72; NaN]); %! assert (a{3}, [NaN; 5]); %! assert (a{4}, {"str1"; "str3"}); @@ -345,9 +345,9 @@ %! str = [str "Km:25 = hhhZ\r\n"]; %! fmt = "Km:%d = hhh%1sjjj miles%dhour"; %! a = textscan (str, fmt, "delimiter", " "); -%! assert (a{1}', int32([10 15 2 25])); +%! assert (a{1}', int32 ([10 15 2 25])); %! assert (a{2}', {'B' 'J' 'R' 'Z'}); -%! assert (a{3}', int32([16 241 3 0])); +%! assert (a{3}', int32 ([16 241 3 0])); %% Test with default endofline parameter %!test @@ -357,7 +357,7 @@ %% Test with endofline parameter set to "" (empty) - newline should be in word %!test %! c = textscan ("L1\nL2", "%s", "endofline", ""); -%! assert (int8(c{:}{:}), int8([ 76, 49, 10, 76, 50 ])); +%! assert (int8 (c{:}{:}), int8 ([ 76, 49, 10, 76, 50 ])); %!test %! # No delimiters at all besides EOL. Skip fields, even empty fields @@ -372,8 +372,8 @@ %! str = sprintf ("%g miles/hr = %g (%g) kilometers (meters)/hr\n", b); %! fmt = "%f miles%s %s %f (%f) kilometers %*s"; %! c = textscan (str, fmt, "collectoutput", 1); -%! assert (size(c{3}), [10, 2]); -%! assert (size(c{2}), [10, 2]); +%! assert (size (c{3}), [10, 2]); +%! assert (size (c{2}), [10, 2]); %!test %% CollectOutput test with uneven column length files @@ -383,9 +383,9 @@ %! str = [str "110 miles/hr"]; %! fmt = "%f miles%s %s %f (%f) kilometers %*s"; %! c = textscan (str, fmt, "collectoutput", 1); -%! assert (size(c{1}), [11, 1]); -%! assert (size(c{3}), [11, 2]); -%! assert (size(c{2}), [11, 2]); +%! assert (size (c{1}), [11, 1]); +%! assert (size (c{3}), [11, 2]); +%! assert (size (c{2}), [11, 2]); %! assert (c{3}(end), NaN); %! assert (c{2}{11, 1}, "/hr"); %! assert (isempty (c{2}{11, 2}), true); @@ -400,5 +400,5 @@ %! Test incomplete first data line %! R = textscan (['Empty1' char(10)], 'Empty%d %f'); -%! assert (R{1}, int32(1)); -%! assert (isempty(R{2}), true); +%! assert (R{1}, int32 (1)); +%! assert (isempty (R{2}), true); diff --git a/scripts/linear-algebra/housh.m b/scripts/linear-algebra/housh.m --- a/scripts/linear-algebra/housh.m +++ b/scripts/linear-algebra/housh.m @@ -23,8 +23,8 @@ ## ## @example ## @group -## (I - beta*housv*housv')x = norm(x)*e(j) if x(j) < 0, -## (I - beta*housv*housv')x = -norm(x)*e(j) if x(j) >= 0 +## (I - beta*housv*housv')x = norm (x)*e(j) if x(j) < 0, +## (I - beta*housv*housv')x = -norm (x)*e(j) if x(j) >= 0 ## @end group ## @end example ## @@ -66,7 +66,7 @@ ## Check for valid inputs. if (! isvector (x) && ! isscalar (x)) error ("housh: first input must be a vector"); - elseif (! isscalar(j)) + elseif (! isscalar (j)) error ("housh: second argment must be an integer scalar"); else housv = x; diff --git a/scripts/linear-algebra/ishermitian.m b/scripts/linear-algebra/ishermitian.m --- a/scripts/linear-algebra/ishermitian.m +++ b/scripts/linear-algebra/ishermitian.m @@ -63,7 +63,7 @@ %!test %! s.a = 1; -%! assert(! ishermitian (s)); +%! assert (! ishermitian (s)); %!error ishermitian ([1, 2; 2, 1], 0, 0) %!error ishermitian () diff --git a/scripts/linear-algebra/issymmetric.m b/scripts/linear-algebra/issymmetric.m --- a/scripts/linear-algebra/issymmetric.m +++ b/scripts/linear-algebra/issymmetric.m @@ -62,7 +62,7 @@ %!test %! s.a = 1; -%! assert(! issymmetric (s)); +%! assert (! issymmetric (s)); %!error issymmetric ([1, 2; 2, 1], 0, 0) %!error issymmetric () diff --git a/scripts/linear-algebra/krylov.m b/scripts/linear-algebra/krylov.m --- a/scripts/linear-algebra/krylov.m +++ b/scripts/linear-algebra/krylov.m @@ -34,7 +34,7 @@ ## meaningless. ## ## If @var{V} is a vector and @var{k} is greater than -## @code{length(A)-1}, then @var{h} contains the Hessenberg matrix such +## @code{length (A) - 1}, then @var{h} contains the Hessenberg matrix such ## that @code{a*u == u*h}. ## ## The value of @var{nu} is the dimension of the span of the Krylov @@ -71,7 +71,7 @@ pflg = 0; endif - if(nargin < 4) + if (nargin < 4) ## Default tolerance parameter. eps1 = defeps; endif @@ -115,14 +115,14 @@ iter = 0; alpha = []; nh = 0; - while (length(alpha) < na) && (columns(V) > 0) && (iter < k) + while (length (alpha) < na) && (columns (V) > 0) && (iter < k) iter++; ## Get orthogonal basis of V. jj = 1; while (jj <= columns (V) && length (alpha) < na) ## Index of next Householder reflection. - nu = length(alpha)+1; + nu = length (alpha)+1; short_pv = pivot_vec(nu:na); q = V(:,jj); diff --git a/scripts/linear-algebra/logm.m b/scripts/linear-algebra/logm.m --- a/scripts/linear-algebra/logm.m +++ b/scripts/linear-algebra/logm.m @@ -104,7 +104,7 @@ s = 2^k * u * s * u'; ## Remove small complex values (O(eps)) which may have entered calculation - if (real_eig && isreal(A)) + if (real_eig && isreal (A)) s = real (s); endif diff --git a/scripts/linear-algebra/null.m b/scripts/linear-algebra/null.m --- a/scripts/linear-algebra/null.m +++ b/scripts/linear-algebra/null.m @@ -67,9 +67,9 @@ if (rank < cols) retval = V (:, rank+1:cols); if (isa (A, "single")) - retval(abs (retval) < eps ("single")) = 0; + retval (abs (retval) < eps ("single")) = 0; else - retval(abs (retval) < eps) = 0; + retval (abs (retval) < eps) = 0; endif else retval = zeros (cols, 0); diff --git a/scripts/linear-algebra/rref.m b/scripts/linear-algebra/rref.m --- a/scripts/linear-algebra/rref.m +++ b/scripts/linear-algebra/rref.m @@ -62,20 +62,20 @@ if (m <= tol) ## Skip column c, making sure the approximately zero terms are ## actually zero. - A (r:rows, c) = zeros (rows-r+1, 1); + A(r:rows, c) = zeros (rows-r+1, 1); else ## keep track of bound variables used (1, c) = 1; ## Swap current row and pivot row - A ([pivot, r], c:cols) = A ([r, pivot], c:cols); + A([pivot, r], c:cols) = A([r, pivot], c:cols); ## Normalize pivot row - A (r, c:cols) = A (r, c:cols) / A (r, c); + A(r, c:cols) = A(r, c:cols) / A(r, c); ## Eliminate the current column ridx = [1:r-1, r+1:rows]; - A (ridx, c:cols) = A (ridx, c:cols) - A (ridx, c) * A(r, c:cols); + A(ridx, c:cols) = A(ridx, c:cols) - A(ridx, c) * A(r, c:cols); ## Check if done if (r++ == rows) diff --git a/scripts/miscellaneous/compare_versions.m b/scripts/miscellaneous/compare_versions.m --- a/scripts/miscellaneous/compare_versions.m +++ b/scripts/miscellaneous/compare_versions.m @@ -66,8 +66,8 @@ ## Note that version "1.1-test2" will compare as greater than ## "1.1-test10". Also, since the numeric part is compared first, "a" ## compares less than "1a" because the second string starts with a -## numeric part even though @code{double("a")} is greater than -## @code{double("1").} +## numeric part even though @code{double ("a")} is greater than +## @code{double ("1").} ## @end deftypefn ## Author: Bill Denney @@ -89,7 +89,7 @@ if (! ischar (operator)) error ("compare_versions: OPERATOR must be a character string"); elseif (numel (operator) > 2) - error("compare_versions: OPERATOR must be 1 or 2 characters long"); + error ("compare_versions: OPERATOR must be 1 or 2 characters long"); endif ## trim off any character data that is not part of a normal version @@ -99,14 +99,14 @@ v1firstchar = find (! ismember (v1, numbers), 1); v2firstchar = find (! ismember (v2, numbers), 1); if (! isempty (v1firstchar)) - v1c = v1(v1firstchar:length(v1)); + v1c = v1(v1firstchar:length (v1)); v1nochar = v1(1:v1firstchar-1); else v1c = ""; v1nochar = v1; endif if (! isempty (v2firstchar)) - v2c = v2(v2firstchar:length(v2)); + v2c = v2(v2firstchar:length (v2)); v2nochar = v2(1:v2firstchar-1); else v2c = ""; @@ -115,7 +115,7 @@ v1n = str2num (char (strsplit (v1nochar, "."))); v2n = str2num (char (strsplit (v2nochar, "."))); - if ((isempty (v1n) && isempty (v1c)) || (isempty (v2n) && isempty(v2c))) + if ((isempty (v1n) && isempty (v1c)) || (isempty (v2n) && isempty (v2c))) error ("compare_versions: given version strings are not valid: %s %s", v1, v2); endif diff --git a/scripts/miscellaneous/copyfile.m b/scripts/miscellaneous/copyfile.m --- a/scripts/miscellaneous/copyfile.m +++ b/scripts/miscellaneous/copyfile.m @@ -72,7 +72,7 @@ ## If f1 has more than 1 element f2 must be a directory isdir = (exist (f2, "dir") != 0); - if (length(f1) > 1 && ! isdir) + if (length (f1) > 1 && ! isdir) error ("copyfile: when copying multiple files, second argument must be a directory"); endif @@ -84,12 +84,12 @@ p1 = sprintf ("\"%s\" ", f1{:}); p2 = tilde_expand (f2); - if (isdir && length(p1) > max_cmd_line) - l2 = length(p2) + length (cmd) + 6; - while (! isempty(f1)) + if (isdir && length (p1) > max_cmd_line) + l2 = length (p2) + length (cmd) + 6; + while (! isempty (f1)) p1 = sprintf ("\"%s\" ", f1{1}); f1(1) = []; - while (!isempty (f1) && (length(p1) + length(f1{1}) + l2 < + while (!isempty (f1) && (length (p1) + length (f1{1}) + l2 < max_cmd_line)) p1 = sprintf ("%s\"%s\" ", p1, f1{1}); f1(1) = []; diff --git a/scripts/miscellaneous/dump_prefs.m b/scripts/miscellaneous/dump_prefs.m --- a/scripts/miscellaneous/dump_prefs.m +++ b/scripts/miscellaneous/dump_prefs.m @@ -82,7 +82,7 @@ "struct_levels_to_print"; "suppress_verbose_help_message"]; - for i = 1:rows(sym_list) + for i = 1:rows (sym_list) sym = deblank (sym_list(i,:)); try val = feval (sym); diff --git a/scripts/miscellaneous/edit.m b/scripts/miscellaneous/edit.m --- a/scripts/miscellaneous/edit.m +++ b/scripts/miscellaneous/edit.m @@ -72,7 +72,7 @@ ## @item editor ## This is the editor to use to modify the functions. By default it uses ## Octave's @env{EDITOR} built-in function, which comes from -## @code{getenv("EDITOR")} and defaults to @code{emacs}. Use @code{%s} +## @code{getenv ("EDITOR")} and defaults to @code{emacs}. Use @code{%s} ## In place of the function name. For example, ## ## @table @samp @@ -179,7 +179,7 @@ if (strcmp (state, "sync") || strcmp (state, "async")) FUNCTION.MODE = state; else - error('edit: expected "edit MODE sync|async"'); + error ('edit: expected "edit MODE sync|async"'); endif case "EDITINPLACE" if (ischar (state)) @@ -193,7 +193,7 @@ endif FUNCTION.EDITINPLACE = state; case "GET" - if (isfield (FUNCTION, toupper(state))) + if (isfield (FUNCTION, toupper (state))) ret = FUNCTION.(toupper (state)); else ret = FUNCTION; @@ -260,7 +260,7 @@ ## If the file includes a path, it may be an overloaded function. if (! strcmp (file, "@") && index (file, filesep)) ## No "@" at the beginning of the file, add to the list. - numfiles = numel(filelist); + numfiles = numel (filelist); for n = 1:numfiles filelist{n+numfiles} = cat (2, "@", filelist{n}); endfor @@ -268,7 +268,7 @@ ## Search the entire path for the 1st instance of a file in the list. fileandpath = ""; - for n = 1:numel(filelist) + for n = 1:numel (filelist) filetoedit = file_in_path (path, filelist{n}); if (! isempty (filetoedit)) ## The path is explicitly included. @@ -324,7 +324,7 @@ ## Guess the email name if it was not given. if (isempty (FUNCTION.EMAIL)) - host = getenv("HOSTNAME"); + host = getenv ("HOSTNAME"); if (isempty (host) && ispc ()) host = getenv ("COMPUTERNAME"); endif @@ -443,11 +443,11 @@ endif if (isempty (head)) comment = cstrcat ("## ", name, "\n\n", - "## ", strrep (tail, "\n", "\n## "), "\n\n"); + "## ", strrep (tail, "\n", "\n## "), "\n\n"); else - comment = cstrcat ("## ", strrep(head,"\n","\n## "), "\n\n", ... - "## ", name, "\n\n", ... - "## ", strrep (tail, "\n", "\n## "), "\n\n"); + comment = cstrcat ("## ", strrep (head,"\n","\n## "), "\n\n", ... + "## ", name, "\n\n", ... + "## ", strrep (tail, "\n", "\n## "), "\n\n"); endif text = cstrcat (comment, body); endswitch diff --git a/scripts/miscellaneous/fileparts.m b/scripts/miscellaneous/fileparts.m --- a/scripts/miscellaneous/fileparts.m +++ b/scripts/miscellaneous/fileparts.m @@ -34,7 +34,7 @@ es = rindex (filename, "."); ## These can be the same if they are both 0 (no dir or ext). if (es <= ds) - es = length(filename)+1; + es = length (filename)+1; endif if (ds == 0) directory = ""; diff --git a/scripts/miscellaneous/getappdata.m b/scripts/miscellaneous/getappdata.m --- a/scripts/miscellaneous/getappdata.m +++ b/scripts/miscellaneous/getappdata.m @@ -33,7 +33,7 @@ ## and missing fields? val = cell (numel (h), 1); appdata = struct (); - for nh = 1:numel(h) + for nh = 1:numel (h) try appdata = get (h(nh), "__appdata__"); end_try_catch diff --git a/scripts/miscellaneous/isappdata.m b/scripts/miscellaneous/isappdata.m --- a/scripts/miscellaneous/isappdata.m +++ b/scripts/miscellaneous/isappdata.m @@ -30,7 +30,7 @@ error ("isappdata: invalid input"); endif - for nh = 1:numel(h) + for nh = 1:numel (h) data = get (h(nh)); if (isfield (data, "__appdata__") && isfield (data.__appdata__, name)) res(nh) = true; diff --git a/scripts/miscellaneous/movefile.m b/scripts/miscellaneous/movefile.m --- a/scripts/miscellaneous/movefile.m +++ b/scripts/miscellaneous/movefile.m @@ -72,7 +72,7 @@ ## If f1 has more than 1 element f2 must be a directory isdir = (exist (f2, "dir") != 0); - if (length(f1) > 1 && ! isdir) + if (length (f1) > 1 && ! isdir) error ("movefile: when moving multiple files, second argument must be a directory"); endif @@ -84,12 +84,12 @@ p1 = sprintf ("\"%s\" ", f1{:}); p2 = tilde_expand (f2); - if (isdir && length(p1) > max_cmd_line) - l2 = length(p2) + length (cmd) + 6; - while (! isempty(f1)) + if (isdir && length (p1) > max_cmd_line) + l2 = length (p2) + length (cmd) + 6; + while (! isempty (f1)) p1 = sprintf ("\"%s\" ", f1{1}); f1(1) = []; - while (!isempty (f1) && (length(p1) + length(f1{1}) + l2 < + while (!isempty (f1) && (length (p1) + length (f1{1}) + l2 < max_cmd_line)) p1 = sprintf ("%s\"%s\" ", p1, f1{1}); f1(1) = []; diff --git a/scripts/miscellaneous/orderfields.m b/scripts/miscellaneous/orderfields.m --- a/scripts/miscellaneous/orderfields.m +++ b/scripts/miscellaneous/orderfields.m @@ -37,7 +37,7 @@ ## ## @example ## @group -## s = struct("d", 4, "b", 2, "a", 1, "c", 3); +## s = struct ("d", 4, "b", 2, "a", 1, "c", 3); ## t1 = orderfields (s) ## @result{} t1 = ## @{ @@ -48,7 +48,7 @@ ## @} ## @end group ## @group -## t = struct("d", @{@}, "c", @{@}, "b", "a", @{@}); +## t = struct ("d", @{@}, "c", @{@}, "b", "a", @{@}); ## t2 = orderfields (s, t) ## @result{} t2 = ## @{ diff --git a/scripts/miscellaneous/parseparams.m b/scripts/miscellaneous/parseparams.m --- a/scripts/miscellaneous/parseparams.m +++ b/scripts/miscellaneous/parseparams.m @@ -88,7 +88,7 @@ if (! size_equal (pnames, values) || ! all (strs(i:2:end))) error_as_caller ("options must be given as name-value pairs"); endif - idx = lookup (toupper(names), toupper(pnames), "m"); + idx = lookup (toupper (names), toupper (pnames), "m"); if (! all (idx)) error_as_caller ("unrecognized option: %s", pnames{find (idx == 0, 1)}); else diff --git a/scripts/miscellaneous/private/__xzip__.m b/scripts/miscellaneous/private/__xzip__.m --- a/scripts/miscellaneous/private/__xzip__.m +++ b/scripts/miscellaneous/private/__xzip__.m @@ -62,13 +62,13 @@ files = glob (files); ## Ignore any file with the compress extension - files(cellfun (@(x) length(x) > length(extension) - && strcmp (x((end - length(extension) + 1):end), extension), + files(cellfun (@(x) length (x) > length (extension) + && strcmp (x((end - length (extension) + 1):end), extension), files)) = []; copyfile (files, outdir); - [d, f] = myfileparts(files); + [d, f] = myfileparts (files); cd (outdir); @@ -87,12 +87,12 @@ f, "uniformoutput", false); endif else - movefile (cellfun(@(x) sprintf ("%s.%s", x, extension), f, + movefile (cellfun (@(x) sprintf ("%s.%s", x, extension), f, "uniformoutput", false), cwd); if (nargout > 0) ## FIXME this does not work when you try to compress directories - entries = cellfun(@(x) sprintf ("%s.%s", x, extension), - files, "uniformoutput", false); + entries = cellfun (@(x) sprintf ("%s.%s", x, extension), + files, "uniformoutput", false); endif endif @@ -119,20 +119,20 @@ ## functions directly. ## ## %!error -## %! __xzip__("gzip", "", "gzip -r %s", "bla"); +## %! __xzip__ ("gzip", "", "gzip -r %s", "bla"); ## %!error -## %! __xzip__("gzip", ".gz", "gzip -r %s", tmpnam); +## %! __xzip__ ("gzip", ".gz", "gzip -r %s", tmpnam); ## %!error ## %! # test __xzip__ with invalid compression command ## %! unwind_protect ## %! filename = tmpnam; ## %! dummy = 1; -## %! save(filename, "dummy"); +## %! save (filename, "dummy"); ## %! dirname = tmpnam; -## %! mkdir(dirname); -## %! entry = __xzip__("gzip", ".gz", "xxxzipxxx -r %s 2>/dev/null", +## %! mkdir (dirname); +## %! entry = __xzip__ ("gzip", ".gz", "xxxzipxxx -r %s 2>/dev/null", ## %! filename, dirname); ## %! unwind_protect_cleanup -## %! delete(filename); -## %! rmdir(dirname); +## %! delete (filename); +## %! rmdir (dirname); ## %! end_unwind_protect diff --git a/scripts/miscellaneous/rmappdata.m b/scripts/miscellaneous/rmappdata.m --- a/scripts/miscellaneous/rmappdata.m +++ b/scripts/miscellaneous/rmappdata.m @@ -29,7 +29,7 @@ error ("rmappdata: invalid input"); endif - for nh = 1:numel(h) + for nh = 1:numel (h) appdata = get (h(nh), "__appdata__"); appdata = rmfield (appdata, varargin); set (h(nh), "__appdata__", appdata); diff --git a/scripts/miscellaneous/setappdata.m b/scripts/miscellaneous/setappdata.m --- a/scripts/miscellaneous/setappdata.m +++ b/scripts/miscellaneous/setappdata.m @@ -30,12 +30,12 @@ error ("setappdata: invalid input"); endif - for nh = 1:numel(h) + for nh = 1:numel (h) if (! isfield (get (h(nh)), "__appdata__")) addproperty ("__appdata__", h(nh), "any", struct ()); endif appdata = get (h(nh), "__appdata__"); - for narg = 1:2:numel(varargin) + for narg = 1:2:numel (varargin) if (iscellstr (varargin{narg})) ## Handle cell arrays like set() does. set (h(nh), "__appdata__", appdata); diff --git a/scripts/miscellaneous/swapbytes.m b/scripts/miscellaneous/swapbytes.m --- a/scripts/miscellaneous/swapbytes.m +++ b/scripts/miscellaneous/swapbytes.m @@ -52,7 +52,7 @@ error ("swapbytes: invalid class of object"); endif y = reshape (typecast (reshape (typecast (x(:), "uint8"), nb, numel (x)) - ([nb : -1 : 1], :) (:), clx), size(x)); + ([nb : -1 : 1], :) (:), clx), size (x)); endif endfunction diff --git a/scripts/miscellaneous/unpack.m b/scripts/miscellaneous/unpack.m --- a/scripts/miscellaneous/unpack.m +++ b/scripts/miscellaneous/unpack.m @@ -39,7 +39,7 @@ endif if (! ischar (file) && ! iscellstr (file)) - error ("unpack: invalid input file class, %s", class(file)); + error ("unpack: invalid input file class, %s", class (file)); endif ## character arrays of more than one string must be treated as cell strings @@ -224,7 +224,7 @@ ## Skip first line which is Archive header output(1) = []; for i = 1:length (output) - files{i} = output{i}(14:length(output{i})); + files{i} = output{i}(14:length (output{i})); endfor endfunction @@ -246,7 +246,7 @@ "Unable to parse line (gzip missing colon):\n%s", output{i}); else midcolon = colons(ceil (length (colons)/2)); - thisstr = output{i}(midcolon+2:length(output{i})); + thisstr = output{i}(midcolon+2:length (output{i})); idx = index (thisstr, "with") + 5; if (isempty (idx)) warning ("unpack:parsing", diff --git a/scripts/miscellaneous/ver.m b/scripts/miscellaneous/ver.m --- a/scripts/miscellaneous/ver.m +++ b/scripts/miscellaneous/ver.m @@ -94,7 +94,7 @@ else if (! isempty (package)) n = []; - for r = 1:numel(ret) + for r = 1:numel (ret) if (strcmpi (ret(r).Name, package)) n = r; break; diff --git a/scripts/optimization/fminbnd.m b/scripts/optimization/fminbnd.m --- a/scripts/optimization/fminbnd.m +++ b/scripts/optimization/fminbnd.m @@ -88,7 +88,7 @@ nfev = 0; sqrteps = eps (class (xmin + xmax)); - c = 0.5*(3-sqrt(5)); + c = 0.5*(3 - sqrt (5)); a = xmin; b = xmax; v = a + c*(b-a); w = x = v; @@ -98,9 +98,9 @@ while (niter < maxiter && nfev < maxfev) xm = 0.5*(a+b); - ## FIXME: the golden section search can actually get closer than sqrt(eps)... - ## sometimes. Sometimes not, it depends on the function. This is the strategy - ## from the Netlib code. Something yet smarter would be good. + ## FIXME: the golden section search can actually get closer than sqrt(eps) + ## sometimes. Sometimes not, it depends on the function. This is the + ## strategy from the Netlib code. Something yet smarter would be good. tol = 2 * sqrteps * abs (x) + tolx / 3; if (abs (x - xm) <= (2*tol - 0.5*(b-a))) info = 1; diff --git a/scripts/optimization/fminunc.m b/scripts/optimization/fminunc.m --- a/scripts/optimization/fminunc.m +++ b/scripts/optimization/fminunc.m @@ -260,7 +260,7 @@ endif ## Update delta. - if (ratio < min(max(0.1, 0.8*lastratio), 0.9)) + if (ratio < min (max (0.1, 0.8*lastratio), 0.9)) delta *= decfac; decfac ^= 1.4142; if (delta <= 1e1*macheps*xn) diff --git a/scripts/optimization/fsolve.m b/scripts/optimization/fsolve.m --- a/scripts/optimization/fsolve.m +++ b/scripts/optimization/fsolve.m @@ -327,7 +327,7 @@ endif ## Update delta. - if (ratio < min(max(0.1, 0.8*lastratio), 0.9)) + if (ratio < min (max (0.1, 0.8*lastratio), 0.9)) nsuc = 0; nfail ++; delta *= decfac; @@ -446,7 +446,7 @@ if (! complexeqn && ! (isreal (fx) && isreal (jx))) error ("fsolve:notreal", "fsolve: non-real value encountered"); - elseif (complexeqn && ! (isnumeric (fx) && isnumeric(jx))) + elseif (complexeqn && ! (isnumeric (fx) && isnumeric (jx))) error ("fsolve:notnum", "fsolve: non-numeric value encountered"); elseif (any (isnan (fx(:)))) error ("fsolve:isnan", "fsolve: NaN value encountered"); diff --git a/scripts/optimization/glpk.m b/scripts/optimization/glpk.m --- a/scripts/optimization/glpk.m +++ b/scripts/optimization/glpk.m @@ -500,7 +500,7 @@ error ("glpk: A cannot be an empty matrix"); return; endif - [nc, nxa] = size(A); + [nc, nxa] = size (A); if (! isreal (A) || nxa != nx) error ("glpk: A must be a real valued %d by %d matrix", nc, nx); return; diff --git a/scripts/optimization/lsqnonneg.m b/scripts/optimization/lsqnonneg.m --- a/scripts/optimization/lsqnonneg.m +++ b/scripts/optimization/lsqnonneg.m @@ -39,7 +39,7 @@ ## @itemize @bullet ## @item resnorm ## -## The squared 2-norm of the residual: norm(@var{c}*@var{x}-@var{d})^2 +## The squared 2-norm of the residual: norm (@var{c}*@var{x}-@var{d})^2 ## ## @item residual ## diff --git a/scripts/optimization/qp.m b/scripts/optimization/qp.m --- a/scripts/optimization/qp.m +++ b/scripts/optimization/qp.m @@ -228,15 +228,15 @@ if (! isempty (lb) && ! isempty (ub)) rtol = sqrt (eps); for i = 1:n - if (abs(lb (i) - ub(i)) < rtol*(1 + max (abs (lb(i) + ub(i))))) + if (abs (lb (i) - ub(i)) < rtol*(1 + max (abs (lb(i) + ub(i))))) ## These are actually an equality constraint - tmprow = zeros(1,n); + tmprow = zeros (1,n); tmprow(i) = 1; A = [A;tmprow]; b = [b; 0.5*(lb(i) + ub(i))]; n_eq = n_eq + 1; else - tmprow = zeros(1,n); + tmprow = zeros (1,n); tmprow(i) = 1; Ain = [Ain; tmprow; -tmprow]; bin = [bin; lb(i); -ub(i)]; diff --git a/scripts/optimization/sqp.m b/scripts/optimization/sqp.m --- a/scripts/optimization/sqp.m +++ b/scripts/optimization/sqp.m @@ -122,7 +122,7 @@ ## iterations. The default value is 100. ## ## The eighth argument @var{tol} specifies the tolerance for the -## stopping criteria. The default value is @code{sqrt(eps)}. +## stopping criteria. The default value is @code{sqrt (eps)}. ## ## The value returned in @var{info} may be one of the following: ## diff --git a/scripts/pkg/private/configure_make.m b/scripts/pkg/private/configure_make.m --- a/scripts/pkg/private/configure_make.m +++ b/scripts/pkg/private/configure_make.m @@ -58,7 +58,7 @@ rmdir (desc.dir, "s"); error ("the configure script returned the following error: %s", output); elseif (verbose) - printf("%s", output); + printf ("%s", output); endif endif @@ -70,7 +70,7 @@ rmdir (desc.dir, "s"); error ("'make' returned the following error: %s", output); elseif (verbose) - printf("%s", output); + printf ("%s", output); endif endif diff --git a/scripts/pkg/private/copy_files.m b/scripts/pkg/private/copy_files.m --- a/scripts/pkg/private/copy_files.m +++ b/scripts/pkg/private/copy_files.m @@ -111,7 +111,7 @@ ## Is there an INDEX file to copy or should we generate one? index_file = fullfile (packdir, "INDEX"); - if (exist(index_file, "file")) + if (exist (index_file, "file")) packinfo_copy_file ("INDEX", "required", packdir, packinfo, desc, octfiledir); else try diff --git a/scripts/pkg/private/describe.m b/scripts/pkg/private/describe.m --- a/scripts/pkg/private/describe.m +++ b/scripts/pkg/private/describe.m @@ -45,7 +45,7 @@ if (describe_all) name_pos = i; else - name_pos = find(strcmp (curr_name, pkgnames)); + name_pos = find (strcmp (curr_name, pkgnames)); endif if (! isempty (name_pos)) diff --git a/scripts/pkg/private/get_description.m b/scripts/pkg/private/get_description.m --- a/scripts/pkg/private/get_description.m +++ b/scripts/pkg/private/get_description.m @@ -35,7 +35,7 @@ while (line != -1) if (line(1) == "#") ## Comments, do nothing. - elseif (isspace(line(1))) + elseif (isspace (line(1))) ## Continuation lines if (exist ("keyword", "var") && isfield (desc, keyword)) desc.(keyword) = cstrcat (desc.(keyword), " ", deblank (line)); diff --git a/scripts/pkg/private/get_forge_pkg.m b/scripts/pkg/private/get_forge_pkg.m --- a/scripts/pkg/private/get_forge_pkg.m +++ b/scripts/pkg/private/get_forge_pkg.m @@ -46,7 +46,7 @@ ## Good. Let's grep for the version. pat = "PackageVersion:([\\d.]*)"; t = regexp (html, pat, "tokens"); - if (isempty (t) || isempty(t{1})) + if (isempty (t) || isempty (t{1})) error ("get_forge_pkg: could not read version number from package's page"); else ver = t{1}{1}; diff --git a/scripts/pkg/private/install.m b/scripts/pkg/private/install.m --- a/scripts/pkg/private/install.m +++ b/scripts/pkg/private/install.m @@ -51,7 +51,7 @@ try ## Warn about non existent files. for i = 1:length (files) - if (isempty (glob(files{i}))) + if (isempty (glob (files{i}))) warning ("file %s does not exist", files{i}); endif endfor @@ -115,7 +115,7 @@ ## Verify that package name corresponds with filename. [dummy, nm] = fileparts (tgz); if ((length (nm) >= length (desc.name)) - && ! strcmp (desc.name, nm(1:length(desc.name)))) + && ! strcmp (desc.name, nm(1:length (desc.name)))) error ("package name '%s' doesn't correspond to its filename '%s'", desc.name, nm); endif @@ -153,15 +153,15 @@ error_text = ""; for i = 1:length (descriptions) desc = descriptions{i}; - idx2 = setdiff (1:length(descriptions), i); + idx2 = setdiff (1:length (descriptions), i); if (global_install) ## Global installation is not allowed to have dependencies on locally ## installed packages. - idx1 = setdiff (1:length(global_packages), packages_to_uninstall); + idx1 = setdiff (1:length (global_packages), packages_to_uninstall); pseudo_installed_packages = {global_packages{idx1}, ... descriptions{idx2}}; else - idx1 = setdiff (1:length(local_packages), packages_to_uninstall); + idx1 = setdiff (1:length (local_packages), packages_to_uninstall); pseudo_installed_packages = {local_packages{idx1}, ... global_packages{:}, ... descriptions{idx2}}; @@ -281,12 +281,12 @@ ## Add the packages to the package list. try if (global_install) - idx = setdiff (1:length(global_packages), packages_to_uninstall); + idx = setdiff (1:length (global_packages), packages_to_uninstall); global_packages = save_order ({global_packages{idx}, descriptions{:}}); save (global_list, "global_packages"); installed_pkgs_lst = {local_packages{:}, global_packages{:}}; else - idx = setdiff (1:length(local_packages), packages_to_uninstall); + idx = setdiff (1:length (local_packages), packages_to_uninstall); local_packages = save_order ({local_packages{idx}, descriptions{:}}); save (local_list, "local_packages"); installed_pkgs_lst = {local_packages{:}, global_packages{:}}; diff --git a/scripts/pkg/private/installed_packages.m b/scripts/pkg/private/installed_packages.m --- a/scripts/pkg/private/installed_packages.m +++ b/scripts/pkg/private/installed_packages.m @@ -52,7 +52,7 @@ endif endfor endfor - if (! isempty(dup)) + if (! isempty (dup)) installed_pkgs_lst(dup) = []; endif @@ -121,9 +121,9 @@ h2 = postpad (h2, max_version_length, " ");; ## Print a header. - header = sprintf("%s | %s | %s\n", h1, h2, h3); + header = sprintf ("%s | %s | %s\n", h1, h2, h3); printf (header); - tmp = sprintf (repmat ("-", 1, length(header)-1)); + tmp = sprintf (repmat ("-", 1, length (header) - 1)); tmp(length(h1)+2) = "+"; tmp(length(h1)+length(h2)+5) = "+"; printf ("%s\n", tmp); diff --git a/scripts/pkg/private/is_architecture_dependent.m b/scripts/pkg/private/is_architecture_dependent.m --- a/scripts/pkg/private/is_architecture_dependent.m +++ b/scripts/pkg/private/is_architecture_dependent.m @@ -36,7 +36,7 @@ endif pos = strfind (nm, ext); if (pos) - if (! isglob && (length(nm) - pos(end) != length(ext) - 1)) + if (! isglob && (length (nm) - pos(end) != length (ext) - 1)) continue; endif dep = true; diff --git a/scripts/pkg/private/load_package_dirs.m b/scripts/pkg/private/load_package_dirs.m --- a/scripts/pkg/private/load_package_dirs.m +++ b/scripts/pkg/private/load_package_dirs.m @@ -36,7 +36,7 @@ if (handle_deps) deps = installed_pkgs_lst{i}.depends; if ((length (deps) > 1) - || (length (deps) == 1 && ! strcmp(deps{1}.package, "octave"))) + || (length (deps) == 1 && ! strcmp (deps{1}.package, "octave"))) tmplidx = []; for k = 1 : length (deps) for j = 1 : length (installed_pkgs_lst) diff --git a/scripts/pkg/private/print_package_description.m b/scripts/pkg/private/print_package_description.m --- a/scripts/pkg/private/print_package_description.m +++ b/scripts/pkg/private/print_package_description.m @@ -31,10 +31,10 @@ printf ("Status:\n\t%s\n", status); if (verbose) printf ("---\nProvides:\n"); - for i = 1:length(pkg_idx_struct) + for i = 1:length (pkg_idx_struct) if (! isempty (pkg_idx_struct{i}.functions)) printf ("%s\n", pkg_idx_struct{i}.category); - for j = 1:length(pkg_idx_struct{i}.functions) + for j = 1:length (pkg_idx_struct{i}.functions) printf ("\t%s\n", pkg_idx_struct{i}.functions{j}); endfor endif diff --git a/scripts/pkg/private/rebuild.m b/scripts/pkg/private/rebuild.m --- a/scripts/pkg/private/rebuild.m +++ b/scripts/pkg/private/rebuild.m @@ -35,7 +35,7 @@ wd = pwd (); unwind_protect cd (prefix); - dirlist = glob (cellfun(@(x) cstrcat(x, '-*'), files, 'uniformoutput', 0)); + dirlist = glob (cellfun(@(x) cstrcat (x, '-*'), files, 'uniformoutput', 0)); unwind_protect_cleanup cd (wd); end_unwind_protect diff --git a/scripts/pkg/private/repackage.m b/scripts/pkg/private/repackage.m --- a/scripts/pkg/private/repackage.m +++ b/scripts/pkg/private/repackage.m @@ -26,7 +26,7 @@ packages = installed_packages (buildlist, buildlist); wd = pwd (); - for i = 1 : length(packages) + for i = 1 : length (packages) pack = packages{i}; unwind_protect cd (builddir); diff --git a/scripts/pkg/private/save_order.m b/scripts/pkg/private/save_order.m --- a/scripts/pkg/private/save_order.m +++ b/scripts/pkg/private/save_order.m @@ -24,10 +24,10 @@ function newdesc = save_order (desc) newdesc = {}; - for i = 1 : length(desc) + for i = 1 : length (desc) deps = desc{i}.depends; if (isempty (deps) - || (length (deps) == 1 && strcmp(deps{1}.package, "octave"))) + || (length (deps) == 1 && strcmp (deps{1}.package, "octave"))) newdesc {end + 1} = desc{i}; else tmpdesc = {}; diff --git a/scripts/pkg/private/shell.m b/scripts/pkg/private/shell.m --- a/scripts/pkg/private/shell.m +++ b/scripts/pkg/private/shell.m @@ -27,8 +27,8 @@ cmd = strrep (cmd, "\\", "/"); if (ispc () && ! isunix ()) - if (isempty(have_sh)) - if (system("sh.exe -c \"exit\"")) + if (isempty (have_sh)) + if (system ("sh.exe -c \"exit\"")) have_sh = false; else have_sh = true; diff --git a/scripts/plot/allchild.m b/scripts/plot/allchild.m --- a/scripts/plot/allchild.m +++ b/scripts/plot/allchild.m @@ -49,7 +49,7 @@ %! hf = figure ("visible", "off"); %! unwind_protect %! l = line; -%! assert(get (allchild (hf),"type"),{"axes"; "uimenu"; "uimenu"; "uimenu"}); +%! assert (get (allchild (hf),"type"),{"axes"; "uimenu"; "uimenu"; "uimenu"}); %! unwind_protect_cleanup %! close (hf); %! graphics_toolkit (toolkit); diff --git a/scripts/plot/ancestor.m b/scripts/plot/ancestor.m --- a/scripts/plot/ancestor.m +++ b/scripts/plot/ancestor.m @@ -49,7 +49,7 @@ endif endif h = num2cell (h); - for nh = 1:numel(h) + for nh = 1:numel (h) while (true) if (isempty (h{nh}) || ! ishandle (h{nh})) break; diff --git a/scripts/plot/area.m b/scripts/plot/area.m --- a/scripts/plot/area.m +++ b/scripts/plot/area.m @@ -80,9 +80,9 @@ y = y(:); endif if (isempty (x)) - x = repmat ([1:size(y, 1)]', 1, size (y, 2)); + x = repmat ([1:size(y, 1)]', 1, columns (y)); elseif (isvector (x)) - x = repmat (x(:), 1, size (y, 2)); + x = repmat (x(:), 1, columns (y)); endif oldax = gca (); diff --git a/scripts/plot/axes.m b/scripts/plot/axes.m --- a/scripts/plot/axes.m +++ b/scripts/plot/axes.m @@ -43,7 +43,7 @@ else ## arg is axes handle. tmp = varargin{1}; - if (length(tmp) == 1 && ishandle (tmp) + if (length (tmp) == 1 && ishandle (tmp) && strcmp (get (tmp, "type"), "axes")) if (__is_handle_visible__ (tmp)) parent = ancestor (tmp, "figure"); diff --git a/scripts/plot/axis.m b/scripts/plot/axis.m --- a/scripts/plot/axis.m +++ b/scripts/plot/axis.m @@ -328,7 +328,7 @@ n = cellfun (@isempty, data); data(n) = cellfun (@(x) x(x<0), tmp(n), "uniformoutput", false); endif - data = cellfun (@(x) x(isfinite(x)), data, "uniformoutput", false); + data = cellfun (@(x) x(isfinite (x)), data, "uniformoutput", false); data = data(! cellfun ("isempty", data)); if (! isempty (data)) lims_min = min (cellfun (@(x) min (x(:)), data(:))); diff --git a/scripts/plot/clabel.m b/scripts/plot/clabel.m --- a/scripts/plot/clabel.m +++ b/scripts/plot/clabel.m @@ -67,7 +67,7 @@ hparent = gca (); else arg = varargin{1}; - if (isscalar (arg) && ishandle(arg) + if (isscalar (arg) && ishandle (arg) && strcmp (get (arg, "type"), "hggroup")) obj = get (arg); if (! isfield (obj, "contourmatrix")) @@ -81,7 +81,7 @@ endif endif - if (length(varargin) > 0 && isnumeric (varargin{1})) + if (length (varargin) > 0 && isnumeric (varargin{1})) v = varargin{1}(:); varargin(1) = []; else diff --git a/scripts/plot/close.m b/scripts/plot/close.m --- a/scripts/plot/close.m +++ b/scripts/plot/close.m @@ -46,7 +46,7 @@ close_all_figures (false); elseif (isfigure (arg1)) figs = arg1; - elseif (isempty(arg1)) + elseif (isempty (arg1)) figs = []; else error ("close: expecting argument to be \"all\" or a figure handle"); diff --git a/scripts/plot/colorbar.m b/scripts/plot/colorbar.m --- a/scripts/plot/colorbar.m +++ b/scripts/plot/colorbar.m @@ -63,7 +63,7 @@ i = 1; while (i <= nargin) arg = varargin {i++}; - if (ischar(arg)) + if (ischar (arg)) if (strcmpi (arg, "peer")) if (i > nargin) error ("colorbar: missing axes handle after \"peer\""); diff --git a/scripts/plot/comet.m b/scripts/plot/comet.m --- a/scripts/plot/comet.m +++ b/scripts/plot/comet.m @@ -44,7 +44,7 @@ print_usage (); elseif (nargin == 1) y = varargin{1}; - x = 1:numel(y); + x = 1:numel (y); p = 0.1; elseif (nargin == 2) x = varargin{1}; diff --git a/scripts/plot/comet3.m b/scripts/plot/comet3.m --- a/scripts/plot/comet3.m +++ b/scripts/plot/comet3.m @@ -43,7 +43,7 @@ print_usage (); elseif (nargin == 1) z = varargin{1}; - x = y = 1:numel(z); + x = y = 1:numel (z); p = 0.1; elseif (nargin == 3) x = varargin{1}; diff --git a/scripts/plot/contour.m b/scripts/plot/contour.m --- a/scripts/plot/contour.m +++ b/scripts/plot/contour.m @@ -83,7 +83,7 @@ %! [theta, r] = meshgrid (linspace (0,2*pi,64), linspace (0,1,64)); %! [X, Y] = pol2cart (theta, r); %! Z = sin (2*theta) .* (1-r); -%! contour (X, Y, abs(Z), 10); +%! contour (X, Y, abs (Z), 10); %!demo %! clf; diff --git a/scripts/plot/cylinder.m b/scripts/plot/cylinder.m --- a/scripts/plot/cylinder.m +++ b/scripts/plot/cylinder.m @@ -65,13 +65,13 @@ endif if (length (r) < 2) - error ("cylinder: length(R) must be larger than 2"); + error ("cylinder: length (R) must be larger than 2"); endif phi = linspace (0, 2*pi, n+1); - idx = 1:length(r); - [phi, idx] = meshgrid(phi, idx); - z = (idx - 1) / (length(r) - 1); + idx = 1:length (r); + [phi, idx] = meshgrid (phi, idx); + z = (idx - 1) / (length (r) - 1); r = r(idx); [x, y] = pol2cart (phi, r); diff --git a/scripts/plot/ezmesh.m b/scripts/plot/ezmesh.m --- a/scripts/plot/ezmesh.m +++ b/scripts/plot/ezmesh.m @@ -58,9 +58,9 @@ ## ## @example ## @group -## fx = @@(s,t) cos (s) .* cos(t); -## fy = @@(s,t) sin (s) .* cos(t); -## fz = @@(s,t) sin(t); +## fx = @@(s,t) cos (s) .* cos (t); +## fy = @@(s,t) sin (s) .* cos (t); +## fz = @@(s,t) sin (t); ## ezmesh (fx, fy, fz, [-pi, pi, -pi/2, pi/2], 20); ## @end group ## @end example @@ -92,8 +92,8 @@ %!demo %! clf; %! colormap ('default'); -%! fx = @(s,t) cos (s) .* cos(t); -%! fy = @(s,t) sin (s) .* cos(t); +%! fx = @(s,t) cos (s) .* cos (t); +%! fy = @(s,t) sin (s) .* cos (t); %! fz = @(s,t) sin (t); %! ezmesh (fx, fy, fz, [-pi,pi,-pi/2,pi/2], 20); diff --git a/scripts/plot/ezsurf.m b/scripts/plot/ezsurf.m --- a/scripts/plot/ezsurf.m +++ b/scripts/plot/ezsurf.m @@ -92,8 +92,8 @@ %!demo %! clf; %! colormap ('default'); -%! fx = @(s,t) cos (s) .* cos(t); -%! fy = @(s,t) sin (s) .* cos(t); +%! fx = @(s,t) cos (s) .* cos (t); +%! fy = @(s,t) sin (s) .* cos (t); %! fz = @(s,t) sin (t); %! ezsurf (fx, fy, fz, [-pi,pi,-pi/2,pi/2], 20); diff --git a/scripts/plot/findobj.m b/scripts/plot/findobj.m --- a/scripts/plot/findobj.m +++ b/scripts/plot/findobj.m @@ -146,7 +146,7 @@ na = na + 1; pvalue{np} = args{na}; na = na + 1; - if (na <= numel(args)) + if (na <= numel (args)) if (ischar (args{na})) if (strcmpi (args{na}, "-and")) logicaloperator{np} = "and"; @@ -192,7 +192,7 @@ while (numel (handles) && ! (idepth >= depth)) children = []; for n = 1 : numel (handles) - children = union (children, get(handles(n), "children")); + children = union (children, get (handles(n), "children")); endfor handles = children; h = union (h, children); @@ -201,7 +201,7 @@ keepers = ones (size (h)); if (numpairs > 0) - for nh = 1 : numel(h) + for nh = 1 : numel (h) p = get (h (nh)); for np = 1 : numpairs fields = fieldnames (p); diff --git a/scripts/plot/fplot.m b/scripts/plot/fplot.m --- a/scripts/plot/fplot.m +++ b/scripts/plot/fplot.m @@ -80,7 +80,7 @@ error ("fplot: first input argument must be a function handle, inline function or string"); endif - if (floor(n) != n) + if (floor (n) != n) tol = n; x0 = linspace (limits(1), limits(2), 5)'; y0 = feval (fn, x0); diff --git a/scripts/plot/hist.m b/scripts/plot/hist.m --- a/scripts/plot/hist.m +++ b/scripts/plot/hist.m @@ -93,7 +93,7 @@ if (nargin == 1 || ischar (varargin{iarg})) n = 10; x = [0.5:n]'/n; - x = x * (max_val - min_val) + ones(size(x)) * min_val; + x = x * (max_val - min_val) + ones (size (x)) * min_val; else ## nargin is either 2 or 3 x = varargin{iarg++}; diff --git a/scripts/plot/isocolors.m b/scripts/plot/isocolors.m --- a/scripts/plot/isocolors.m +++ b/scripts/plot/isocolors.m @@ -98,7 +98,7 @@ ## Author: Martin Helm -function varargout = isocolors(varargin) +function varargout = isocolors (varargin) calc_rgb = false; switch (nargin) case 2 diff --git a/scripts/plot/isonormals.m b/scripts/plot/isonormals.m --- a/scripts/plot/isonormals.m +++ b/scripts/plot/isonormals.m @@ -95,7 +95,7 @@ ## Author: Martin Helm -function varargout = isonormals(varargin) +function varargout = isonormals (varargin) na = nargin; negate = false; if (ischar (varargin{nargin})) diff --git a/scripts/plot/isosurface.m b/scripts/plot/isosurface.m --- a/scripts/plot/isosurface.m +++ b/scripts/plot/isosurface.m @@ -118,7 +118,7 @@ ## Author: Martin Helm -function varargout = isosurface(varargin) +function varargout = isosurface (varargin) if (nargin < 2 || nargin > 8 || nargout > 3) print_usage (); diff --git a/scripts/plot/isprop.m b/scripts/plot/isprop.m --- a/scripts/plot/isprop.m +++ b/scripts/plot/isprop.m @@ -37,7 +37,7 @@ endif res = false (size (h)); - for n = 1:numel(res) + for n = 1:numel (res) res(n) = true; try v = get (h(n), prop); diff --git a/scripts/plot/legend.m b/scripts/plot/legend.m --- a/scripts/plot/legend.m +++ b/scripts/plot/legend.m @@ -145,7 +145,7 @@ kids = ca; kids (strcmp (get (ca, "tag"), "legend")) = []; if (isscalar (kids)) - kids = get(kids, "children")(:); + kids = get (kids, "children")(:); else kids = flipud ([get(kids, "children"){:}](:)); endif @@ -215,7 +215,7 @@ hlegend = []; fkids = get (fig, "children"); - for i = 1 : numel(fkids) + for i = 1 : numel (fkids) if (ishandle (fkids (i)) && strcmp (get (fkids (i), "type"), "axes") && (strcmp (get (fkids (i), "tag"), "legend"))) udata = get (fkids (i), "userdata"); @@ -498,8 +498,8 @@ ## FIXME hlegend should inherit properties from "ca" curaxes = get (fig, "currentaxes"); unwind_protect - ud = ancestor(hplots, "axes"); - if (!isscalar(ud)) + ud = ancestor (hplots, "axes"); + if (!isscalar (ud)) ud = unique ([ud{:}]); endif if (isempty (hlegend)) @@ -707,13 +707,13 @@ hobjects = [hobjects, l1]; endif - addlistener(hplots(k), "color", {@updateline, hlegend, linelength}); - addlistener(hplots(k), "linestyle", {@updateline, hlegend, linelength}); - addlistener(hplots(k), "marker", {@updateline, hlegend, linelength}); - addlistener(hplots(k), "markeredgecolor", {@updateline, hlegend, linelength}); - addlistener(hplots(k), "markerfacecolor", {@updateline, hlegend, linelength}); - addlistener(hplots(k), "markersize", {@updateline, hlegend, linelength}); - addlistener(hplots(k), "displayname", {@updateline, hlegend, linelength}); + addlistener (hplots(k), "color", {@updateline, hlegend, linelength}); + addlistener (hplots(k), "linestyle", {@updateline, hlegend, linelength}); + addlistener (hplots(k), "marker", {@updateline, hlegend, linelength}); + addlistener (hplots(k), "markeredgecolor", {@updateline, hlegend, linelength}); + addlistener (hplots(k), "markerfacecolor", {@updateline, hlegend, linelength}); + addlistener (hplots(k), "markersize", {@updateline, hlegend, linelength}); + addlistener (hplots(k), "displayname", {@updateline, hlegend, linelength}); case "patch" facecolor = get (hplots(k), "facecolor"); edgecolor = get (hplots(k), "edgecolor"); @@ -959,7 +959,7 @@ ypos1 = get (ll,"ydata"); xpos1 = get (ll,"xdata"); ypos2 = ypos1(1); - xpos2 = sum(xpos1) / 2; + xpos2 = sum (xpos1) / 2; delete (ll); if (! isempty (lm)) delete (lm); diff --git a/scripts/plot/mesh.m b/scripts/plot/mesh.m --- a/scripts/plot/mesh.m +++ b/scripts/plot/mesh.m @@ -65,7 +65,7 @@ %!demo %! clf (); -%! x = logspace(0,1,11); +%! x = logspace (0,1,11); %! z = x'*x; %! mesh (x, x, z, z.^2); %! xlabel xlabel @@ -74,7 +74,7 @@ %!demo %! clf (); -%! x = logspace(0,1,11); +%! x = logspace (0,1,11); %! z = x'*x; %! mesh (x, x, z, z.^2); %! set (gca, "zscale", "log") diff --git a/scripts/plot/meshz.m b/scripts/plot/meshz.m --- a/scripts/plot/meshz.m +++ b/scripts/plot/meshz.m @@ -68,7 +68,7 @@ y(end, 1), y(end, :), y(end, end)]; endif - zref = min(z(isfinite(z))); + zref = min (z(isfinite (z))); z = [zref .* ones(1, size(z, 2) + 2); zref .* ones(size(z, 1), 1), z, zref .* ones(size(z, 1), 1); zref.* ones(1, size(z, 2) + 2)]; diff --git a/scripts/plot/pareto.m b/scripts/plot/pareto.m --- a/scripts/plot/pareto.m +++ b/scripts/plot/pareto.m @@ -74,20 +74,20 @@ endif endif else - y = cellfun ("int2str", num2cell (1 : numel(x)), + y = cellfun ("int2str", num2cell (1 : numel (x)), "uniformoutput", false); endif [x, idx] = sort (x, "descend"); y = y (idx); cdf = cumsum (x); - maxcdf = max(cdf); + maxcdf = max (cdf); cdf = cdf ./ maxcdf; cdf95 = cdf - 0.95; - idx95 = find(sign(cdf95(1:end-1)) != sign(cdf95(2:end)))(1); + idx95 = find (sign (cdf95(1:end-1)) != sign (cdf95(2:end)))(1); [ax, hbar, hline] = plotyy (1 : idx95, x (1 : idx95), - 1 : length(cdf), 100 .* cdf, + 1 : length (cdf), 100 .* cdf, @bar, @plot); axis (ax(1), [1 - 0.6, idx95 + 0.6, 0, maxcdf]); diff --git a/scripts/plot/pcolor.m b/scripts/plot/pcolor.m --- a/scripts/plot/pcolor.m +++ b/scripts/plot/pcolor.m @@ -55,7 +55,7 @@ if (nargin == 1) c = x; - [nr, nc] = size(c); + [nr, nc] = size (c); z = zeros (nr, nc); [x, y] = meshgrid (1:nc, 1:nr); elseif (nargin == 3) diff --git a/scripts/plot/peaks.m b/scripts/plot/peaks.m --- a/scripts/plot/peaks.m +++ b/scripts/plot/peaks.m @@ -69,9 +69,9 @@ Y = y; endif - Z = 3 * (1 - X) .^ 2 .* exp(- X .^ 2 - (Y + 1) .^ 2) ... - - 10 * (X / 5 - X .^ 3 - Y .^ 5) .* exp(- X .^ 2 - Y .^ 2) ... - - 1 / 3 * exp(- (X + 1) .^ 2 - Y .^ 2); + Z = 3 * (1 - X) .^ 2 .* exp (- X .^ 2 - (Y + 1) .^ 2) ... + - 10 * (X / 5 - X .^ 3 - Y .^ 5) .* exp (- X .^ 2 - Y .^ 2) ... + - 1 / 3 * exp (- (X + 1) .^ 2 - Y .^ 2); if (nargout == 0) surf (x, y, Z); diff --git a/scripts/plot/plot3.m b/scripts/plot/plot3.m --- a/scripts/plot/plot3.m +++ b/scripts/plot/plot3.m @@ -121,10 +121,10 @@ y = real (x); y_set = 1; z_set = 1; - if (rows(x) > 1) - x = repmat ((1:rows(x))', 1, columns(x)); + if (rows (x) > 1) + x = repmat ((1:rows (x))', 1, columns (x)); else - x = 1:columns(x); + x = 1:columns (x); endif endif else @@ -164,7 +164,7 @@ elseif (length (x) == rows (z) && length (y) == columns (z)) [x, y] = meshgrid (x, y); else - error ("plot3: [length(x), length(y)] must match size(z)"); + error ("plot3: [length(x), length(y)] must match size (z)"); endif endif @@ -218,7 +218,7 @@ elseif (length (x) == rows (z) && length (y) == columns (z)) [x, y] = meshgrid (x, y); else - error ("plot3: [length(x), length(y)] must match size(z)"); + error ("plot3: [length(x), length(y)] must match size (z)"); endif endif @@ -278,9 +278,9 @@ y_set = 1; z_set = 1; if (rows (x) > 1) - x = repmat ((1:rows (x))', 1, columns(x)); + x = repmat ((1:rows (x))', 1, columns (x)); else - x = 1:columns(x); + x = 1:columns (x); endif endif @@ -292,7 +292,7 @@ elseif (length (x) == rows (z) && length (y) == columns (z)) [x, y] = meshgrid (x, y); else - error ("plot3: [length(x), length(y)] must match size(z)"); + error ("plot3: [length(x), length(y)] must match size (z)"); endif endif diff --git a/scripts/plot/plotmatrix.m b/scripts/plot/plotmatrix.m --- a/scripts/plot/plotmatrix.m +++ b/scripts/plot/plotmatrix.m @@ -145,7 +145,7 @@ returm; endif - if (rows(X) != rows(Y)) + if (rows (X) != rows (Y)) error ("plotmatrix: dimension mismatch in the arguments"); endif diff --git a/scripts/plot/plotyy.m b/scripts/plot/plotyy.m --- a/scripts/plot/plotyy.m +++ b/scripts/plot/plotyy.m @@ -56,8 +56,8 @@ function [Ax, H1, H2] = plotyy (varargin) ## Don't use __plt_get_axis_arg__ here as ax is a two vector for plotyy - if (nargin > 1 && length (varargin{1}) == 2 && ishandle(varargin{1}(1)) - && ishandle(varargin{1}(2)) + if (nargin > 1 && length (varargin{1}) == 2 && ishandle (varargin{1}(1)) + && ishandle (varargin{1}(2)) && all (floor (varargin{1}) != varargin{1})) obj1 = get (varargin{1}(1)); obj2 = get (varargin{1}(2)); @@ -111,7 +111,7 @@ [ax, h1, h2] = __plotyy__ (ax, varargin{:}); unwind_protect_cleanup ## Only change back to the old axis if we didn't delete it - if (ishandle(oldh) && strcmp (get (oldh, "type"), "axes")) + if (ishandle (oldh) && strcmp (get (oldh, "type"), "axes")) axes (oldh); endif end_unwind_protect @@ -138,7 +138,7 @@ xlim = [min([x1(:); x2(:)]), max([x1(:); x2(:)])]; - if (ishandle(ax(1)) && strcmp (get (ax(1), "type"), "axes")) + if (ishandle (ax(1)) && strcmp (get (ax(1), "type"), "axes")) axes (ax(1)); else ax(1) = axes (); @@ -153,7 +153,7 @@ cf = gcf (); set (cf, "nextplot", "add"); - if (ishandle(ax(2)) && strcmp (get (ax(2), "type"), "axes")) + if (ishandle (ax(2)) && strcmp (get (ax(2), "type"), "axes")) axes (ax(2)); else ax(2) = axes (); diff --git a/scripts/plot/polar.m b/scripts/plot/polar.m --- a/scripts/plot/polar.m +++ b/scripts/plot/polar.m @@ -55,8 +55,8 @@ elseif (nargs == 2) if (ischar (varargin{2})) tmp = __plr1__ (h, varargin{:}); - if (iscomplex(varargin{1})) - maxr = max (imag(varargin{1})(:)); + if (iscomplex (varargin{1})) + maxr = max (imag (varargin{1})(:)); else maxr = max (varargin{1}(:)); endif @@ -68,8 +68,8 @@ elseif (nargs == 1) fmt = ""; tmp = __plr1__ (h, varargin{:}, fmt); - if (iscomplex(varargin{1})) - maxr = max (imag(varargin{1})(:)); + if (iscomplex (varargin{1})) + maxr = max (imag (varargin{1})(:)); else maxr = max (varargin{1}(:)); endif diff --git a/scripts/plot/print.m b/scripts/plot/print.m --- a/scripts/plot/print.m +++ b/scripts/plot/print.m @@ -333,7 +333,7 @@ if (opts.force_solid != 0) h = findall (opts.figure, "-property", "linestyle"); m = numel (props); - for n = 1:numel(h) + for n = 1:numel (h) props(m+n).h = h(n); props(m+n).name = "linestyle"; props(m+n).value = {get(h(n), "linestyle")}; @@ -349,12 +349,12 @@ if (opts.use_color < 0 && ! strcmp (get (opts.figure, "__graphics_toolkit__"), "gnuplot")) color_props = {"color", "facecolor", "edgecolor", "colormap"}; - for c = 1:numel(color_props) + for c = 1:numel (color_props) h = findall (opts.figure, "-property", color_props{c}); hnone = findall (opts.figure, color_props{c}, "none"); h = setdiff (h, hnone); m = numel (props); - for n = 1:numel(h) + for n = 1:numel (h) if (ishandle (h(n))) ## Need to verify objects exist since callbacks may delete objects ## as the colors for others are modified. @@ -376,7 +376,7 @@ if (! isempty (opts.font) || ! isempty (opts.fontsize)) h = findall (opts.figure, "-property", "fontname"); m = numel (props); - for n = 1:numel(h) + for n = 1:numel (h) if (ishandle (h(n))) if (! isempty (opts.font)) props(end+1).h = h(n); @@ -393,7 +393,7 @@ endif endfor if (! isempty (opts.font)) - set (h(ishandle(h)), "fontname", opts.font); + set (h(ishandle (h)), "fontname", opts.font); endif if (! isempty (opts.fontsize)) if (ischar (opts.fontsize)) @@ -405,7 +405,7 @@ ## This is done to work around the bbox being whole numbers. fontsize = fontsize * opts.scalefontsize; endif - set (h(ishandle(h)), "fontsize", fontsize); + set (h(ishandle (h)), "fontsize", fontsize); endif endif @@ -420,7 +420,7 @@ unwind_protect_cleanup ## restore modified properties if (isstruct (props)) - for n = numel(props):-1:1 + for n = numel (props):-1:1 if (ishandle (props(n).h)) set (props(n).h, props(n).name, props(n).value{1}); endif @@ -428,7 +428,7 @@ endif ## Unlink temporary files - for n = 1:numel(opts.unlink) + for n = 1:numel (opts.unlink) [status, output] = unlink (opts.unlink{n}); if (status != 0) warning ("print.m: %s, '%s'", output, opts.unlink{n}); diff --git a/scripts/plot/private/__add_datasource__.m b/scripts/plot/private/__add_datasource__.m --- a/scripts/plot/private/__add_datasource__.m +++ b/scripts/plot/private/__add_datasource__.m @@ -39,7 +39,7 @@ newargs = {}; while (i < numel (varargin)) arg = varargin{++i}; - if (i != numel(varargin) && ischar (arg) + if (i != numel (varargin) && ischar (arg) && length (arg) > 9 && strcmpi (arg(end-9:end), "datasource")) arg = tolower (arg); val = varargin{++i}; diff --git a/scripts/plot/private/__add_default_menu__.m b/scripts/plot/private/__add_default_menu__.m --- a/scripts/plot/private/__add_default_menu__.m +++ b/scripts/plot/private/__add_default_menu__.m @@ -98,12 +98,12 @@ endfunction function guimode_cb (h, e) - lbl = get(h, "label"); - if (strncmp(lbl, "Pan+Zoom", 8)) - gui_mode("2D"); - elseif (strncmp(lbl, "Rotate+Zoom", 11)) - gui_mode("3D"); - elseif (strncmp(lbl, "None", 4)) - gui_mode("None"); + lbl = get (h, "label"); + if (strncmp (lbl, "Pan+Zoom", 8)) + gui_mode ("2D"); + elseif (strncmp (lbl, "Rotate+Zoom", 11)) + gui_mode ("3D"); + elseif (strncmp (lbl, "None", 4)) + gui_mode ("None"); endif endfunction diff --git a/scripts/plot/private/__axes_limits__.m b/scripts/plot/private/__axes_limits__.m --- a/scripts/plot/private/__axes_limits__.m +++ b/scripts/plot/private/__axes_limits__.m @@ -41,7 +41,7 @@ set (h, fcnmode, arg); endif else - if (!isnumeric (arg) && any (size(arg(:)) != [2, 1])) + if (!isnumeric (arg) && any (size (arg(:)) != [2, 1])) error ("%s: argument must be a 2 element vector", fcn); else if (arg(1) >= arg(2)) diff --git a/scripts/plot/private/__bar__.m b/scripts/plot/private/__bar__.m --- a/scripts/plot/private/__bar__.m +++ b/scripts/plot/private/__bar__.m @@ -89,7 +89,7 @@ continue; endif endif - if (isscalar(varargin{idx})) + if (isscalar (varargin{idx})) width = varargin{idx++}; elseif (idx == nargin - 2) newargs = [newargs,varargin(idx++)]; @@ -117,7 +117,7 @@ ycols = size (y, 2); if (numel (x) > 1) - cutoff = min (diff (double(x))) / 2; + cutoff = min (diff (double (x))) / 2; else cutoff = 1; endif @@ -139,7 +139,7 @@ y0 = zeros (size (y)) + bv; y1 = y; else - y1 = cumsum(y,2); + y1 = cumsum (y,2); y0 = [zeros(ylen,1)+bv, y1(:,1:end-1)]; endif @@ -196,10 +196,10 @@ else lev = (i - 1) * (clim(2) - clim(1)) / (ycols - 1) - clim(1); endif - h = patch(xb(:,:,i), yb(:,:,i), "FaceColor", "flat", - "cdata", lev, "parent", hg); + h = patch (xb(:,:,i), yb(:,:,i), "FaceColor", "flat", + "cdata", lev, "parent", hg); else - h = patch(xb(:,:,i), yb(:,:,i), "parent", hg); + h = patch (xb(:,:,i), yb(:,:,i), "parent", hg); endif else if (! have_color_spec) @@ -208,10 +208,10 @@ else lev = (i - 1) * (clim(2) - clim(1)) / (ycols - 1) - clim(1); endif - h = patch(yb(:,:,i), xb(:,:,i), "FaceColor", "flat", - "cdata", lev, "parent", hg); + h = patch (yb(:,:,i), xb(:,:,i), "FaceColor", "flat", + "cdata", lev, "parent", hg); else - h = patch(yb(:,:,i), xb(:,:,i), "parent", hg); + h = patch (yb(:,:,i), xb(:,:,i), "parent", hg); endif endif @@ -403,7 +403,7 @@ unwind_protect recursion = true; hlist = get (h, "bargroup"); - barwidth = get(h, "barwidth"); + barwidth = get (h, "barwidth"); barlayout = get (h, "barlayout"); horizontal = get (h, "horizontal"); diff --git a/scripts/plot/private/__clabel__.m b/scripts/plot/private/__clabel__.m --- a/scripts/plot/private/__clabel__.m +++ b/scripts/plot/private/__clabel__.m @@ -25,10 +25,10 @@ ## FIXME ## Assume that the plot size is 4 by 3 inches. lims = axis (); - xspacing = 72 * 4 / abs(lims(1) - lims(2)); - yspacing = 72 * 3 / abs(lims(3) - lims(4)); + xspacing = 72 * 4 / abs (lims(1) - lims(2)); + yspacing = 72 * 3 / abs (lims(3) - lims(4)); - if (isscalar (hparent) && ishandle(hparent) + if (isscalar (hparent) && ishandle (hparent) && strcmp (get (hparent, "type"), "hggroup")) x = get (hparent, "xdata"); xmin = min (x(:)); @@ -67,14 +67,14 @@ p = c(:, i1+1:i1+clen) .* repmat ([xspacing; yspacing], 1, clen); d = sqrt (sumsq (diff (p, 1, 2))); cumd = cumsum (d); - td = sum(d); + td = sum (d); ntag = ceil (td / label_spacing); if (all (c(:,i1+1) == c(:,i1+clen))) Spacing = td / ntag; pos = Spacing / 2 + [0:ntag-1] * Spacing; else - pos = zeros(1, ntag); + pos = zeros (1, ntag); pos(1) = (td - label_spacing * (ntag - 1)) ./ 2; pos(2:ntag) = pos(1) + [1:ntag-1] * label_spacing; endif @@ -87,7 +87,7 @@ while (j1 < clen && cumd(j1) < tagpos) j1++; endwhile - tpos = sum(c(:,i1+j1-1:i1+j1), 2) ./ 2; + tpos = sum (c(:,i1+j1-1:i1+j1), 2) ./ 2; if (tpos(1) != xmin && tpos(1) != xmax && tpos(2) != ymin && tpos(2) != ymax) @@ -112,4 +112,4 @@ endfor i1 += clen+1; endwhile -endfunction \ No newline at end of file +endfunction diff --git a/scripts/plot/private/__contour__.m b/scripts/plot/private/__contour__.m --- a/scripts/plot/private/__contour__.m +++ b/scripts/plot/private/__contour__.m @@ -79,10 +79,10 @@ endif endwhile - if (length(varargin) < 5) + if (length (varargin) < 5) z1 = varargin{3}; - x1 = 1 : columns(z1); - y1 = 1 : rows(z1); + x1 = 1 : columns (z1); + y1 = 1 : rows (z1); else x1 = varargin{3}; y1 = varargin{4}; @@ -100,7 +100,7 @@ endif if (isscalar (vn)) - lvl = linspace (min (z1(!isinf(z1))), max (z1(!isinf(z1))), + lvl = linspace (min (z1(!isinf (z1))), max (z1(!isinf (z1))), vn + 2)(1:end-1); else lvl = vn; @@ -111,13 +111,13 @@ [x1, y1] = meshgrid (x1, y1); endif [nr, nc] = size (z1); - x0 = prepad(x1, nc+1, 2 * x1(1, 1) - x1(1, 2), 2); - x0 = postpad(x0, nc+2, 2 * x1(1, nc) - x1(1, nc - 1), 2); + x0 = prepad (x1, nc+1, 2 * x1(1, 1) - x1(1, 2), 2); + x0 = postpad (x0, nc+2, 2 * x1(1, nc) - x1(1, nc - 1), 2); x0 = [x0(1, :); x0; x0(1, :)]; - y0 = prepad(y1, nr+1, 2 * y1(1, 1) - y1(2, 1), 1); - y0 = postpad(y0, nr+2, 2 * y1(nr, 1) - y1(nr - 1, 1)); + y0 = prepad (y1, nr+1, 2 * y1(1, 1) - y1(2, 1), 1); + y0 = postpad (y0, nr+2, 2 * y1(nr, 1) - y1(nr - 1, 1)); y0 = [y0(:, 1), y0, y0(:, 1)]; - z0 = -Inf(nr+2, nc+2); + z0 = -Inf (nr+2, nc+2); z0(2:nr+1, 2:nc+1) = z1; [c, lev] = contourc (x0, y0, z0, lvl); else @@ -211,7 +211,7 @@ add_patch_children (hg); - axis("tight"); + axis ("tight"); if (!isempty (opts)) set (hg, opts{:}); @@ -258,7 +258,7 @@ lvl_idx = find (abs (cont_lev - lev(k)) < lvl_eps); len = numel (lvl_idx); if (len > 1) - ## mark = logical(zeros(size(lvl_idx))); + ## mark = logical (zeros (size (lvl_idx))); mark = false (size (lvl_idx)); a = 1; while (a < len) @@ -283,7 +283,7 @@ ma_idx = lvl_idx(mark); if (k > 1) ## Find color of level below. - tmp = find(abs(cont_lev - lev(k - 1)) < lvl_eps); + tmp = find (abs (cont_lev - lev(k - 1)) < lvl_eps); lvl_bel_idx = tmp(1); ## Set color of patches found. cont_lev(ma_idx) = cont_lev(lvl_bel_idx); @@ -319,7 +319,7 @@ else ## Special case unclosed contours endif - if (isnan(cont_lev(idx))) + if (isnan (cont_lev (idx))) fc = get (ca, "color"); if (strcmp (fc, "none")) fc = get (ancestor (ca, "figure"), "color"); @@ -458,13 +458,13 @@ [X, Y] = meshgrid (X, Y); endif [nr, nc] = size (Z); - X0 = prepad(X, nc+1, 2 * X(1, 1) - X(1, 2), 2); - X0 = postpad(X0, nc+2, 2 * X(1, nc) - X(1, nc - 1), 2); + X0 = prepad (X, nc+1, 2 * X(1, 1) - X(1, 2), 2); + X0 = postpad (X0, nc+2, 2 * X(1, nc) - X(1, nc - 1), 2); X0 = [X0(1, :); X0; X0(1, :)]; - Y0 = prepad(Y, nr+1, 2 * Y(1, 1) - Y(2, 1), 1); - Y0 = postpad(Y0, nr+2, 2 * Y(nr, 1) - Y(nr - 1, 1)); + Y0 = prepad (Y, nr+1, 2 * Y(1, 1) - Y(2, 1), 1); + Y0 = postpad (Y0, nr+2, 2 * Y(nr, 1) - Y(nr - 1, 1)); Y0 = [Y0(:, 1), Y0, Y0(:, 1)]; - Z0 = -Inf(nr+2, nc+2); + Z0 = -Inf (nr+2, nc+2); Z0(2:nr+1, 2:nc+1) = Z; [c, lev] = contourc (X0, Y0, Z0, lvl); else @@ -480,7 +480,7 @@ else set (h, "levellist", lev); z = get (h, "zdata"); - lvlstep = (max(z(:)) - min(z(:))) / 10; + lvlstep = (max (z(:)) - min (z(:))) / 10; set (h, "levelstep", lvlstep); endif diff --git a/scripts/plot/private/__errcomm__.m b/scripts/plot/private/__errcomm__.m --- a/scripts/plot/private/__errcomm__.m +++ b/scripts/plot/private/__errcomm__.m @@ -34,7 +34,7 @@ nargs = length (varargin); retval = []; k = 1; - data = cell(6,1); + data = cell (6,1); while (k <= nargs) a = varargin{k++}; if (isvector (a)) diff --git a/scripts/plot/private/__errplot__.m b/scripts/plot/private/__errplot__.m --- a/scripts/plot/private/__errplot__.m +++ b/scripts/plot/private/__errplot__.m @@ -71,7 +71,7 @@ (__line__ (hg, "linestyle", "-", "marker", "none", "color", fmt.color))]; - switch (numel(varargin)) + switch (numel (varargin)) case 2 ydata = varargin{1}(:,i); xdata = 1:numel (ydata); @@ -232,7 +232,7 @@ xhi = xdata + dx; else n = xdata > 0; - rx = exp(0.01 * (max (log(xdata(n))) - min (log(xdata(n))))); + rx = exp (0.01 * (max (log (xdata(n))) - min (log (xdata(n))))); xlo = xdata/rx; xhi = xdata*rx; endif @@ -242,7 +242,7 @@ yhi = ydata + dy; else n = ydata > 0; - ry = exp(0.01 * (max (log(ydata(n))) - min (log(ydata(n))))); + ry = exp (0.01 * (max (log (ydata(n))) - min (log (ydata(n))))); ylo = ydata/ry; yhi = ydata*ry; endif diff --git a/scripts/plot/private/__ezplot__.m b/scripts/plot/private/__ezplot__.m --- a/scripts/plot/private/__ezplot__.m +++ b/scripts/plot/private/__ezplot__.m @@ -74,9 +74,9 @@ endif fstr = formula (fun); if (isplot) - xarg = argnames(fun){1}; + xarg = (argnames (fun)){1}; if (nargs == 2) - yarg = argnames(fun){2}; + yarg = (argnames (fun)){2}; else yarg = ""; endif @@ -87,8 +87,8 @@ xarg = ""; yarg = ""; else - xarg = argnames(fun){1}; - yarg = argnames(fun){2}; + xarg = (argnames (fun)){1}; + yarg = (argnames (fun)){2}; endif elseif (strcmp (typeinfo (fun), "inline function")) if (isplot && length (argnames (fun)) == 2) @@ -99,9 +99,9 @@ fun = vectorize (fun); fstr = formula (fun); if (isplot) - xarg = argnames(fun){1}; + xarg = (argnames (fun)){1}; if (nargs == 2) - yarg = argnames(fun){2}; + yarg = (argnames (fun)){2}; else yarg = ""; endif @@ -112,8 +112,8 @@ xarg = ""; yarg = ""; else - xarg = argnames(fun)(1); - yarg = argnames(fun)(2); + xarg = (argnames (fun))(1); + yarg = (argnames (fun))(2); endif elseif (isa (fun, "function_handle")) fstr = func2str (fun); @@ -392,10 +392,10 @@ yrange = [XX(1), XX(end)]; endif - idx = 2 : length(Z); + idx = 2 : length (Z); idx = find (((Z(idx) > yrange(2) / 2) & (Z(idx-1) < yrange(1) / 2)) | ((Z(idx) < yrange(1) / 2) & (Z(idx-1) > yrange (2) / 2))); - if (any(idx)) + if (any (idx)) Z(idx) = NaN; endif else @@ -441,5 +441,5 @@ function x = __eliminate_sing__ (x) x (isinf (x)) = NaN; - x (abs (del2 (x)) > 0.2 * (max(x(:)) - min(x(:)))) = NaN; + x (abs (del2 (x)) > 0.2 * (max (x(:)) - min (x(:)))) = NaN; endfunction diff --git a/scripts/plot/private/__file_filter__.m b/scripts/plot/private/__file_filter__.m --- a/scripts/plot/private/__file_filter__.m +++ b/scripts/plot/private/__file_filter__.m @@ -81,7 +81,7 @@ endswitch if (isempty (name)) - extlist = strsplit(filterext, ";"); + extlist = strsplit (filterext, ";"); extlist = strrep (extlist, "*.", ""); extlist = toupper (extlist); extlist(end+1, :) = repmat ({","}, 1, length (extlist)); diff --git a/scripts/plot/private/__fltk_print__.m b/scripts/plot/private/__fltk_print__.m --- a/scripts/plot/private/__fltk_print__.m +++ b/scripts/plot/private/__fltk_print__.m @@ -125,9 +125,9 @@ [cmd_gs, cmd_cleanup] = __ghostscript__ (opts.ghostscript); if (opts.send_to_printer || isempty (opts.name)) cmd_lpr = opts.lpr_cmd (opts); - cmd = sprintf("%s | %s", cmd_gs, cmd_lpr); + cmd = sprintf ("%s | %s", cmd_gs, cmd_lpr); else - cmd = sprintf("%s", cmd_gs); + cmd = sprintf ("%s", cmd_gs); endif if (! isempty (cmd_cleanup)) gl2ps_device = {"eps"}; @@ -159,11 +159,11 @@ gl2ps_device{end} = [gl2ps_device{end}, "is2D"]; endif - for n = 1:numel(pipeline) + for n = 1:numel (pipeline) if (opts.debug) fprintf ("fltk-pipeline: '%s'\n", pipeline{n}); endif - drawnow (gl2ps_device{n}, strcat('|',pipeline{n})); + drawnow (gl2ps_device{n}, strcat ('|',pipeline{n})); endfor if (! isempty (strfind (opts.devopt, "standalone"))) diff --git a/scripts/plot/private/__ghostscript__.m b/scripts/plot/private/__ghostscript__.m --- a/scripts/plot/private/__ghostscript__.m +++ b/scripts/plot/private/__ghostscript__.m @@ -49,12 +49,12 @@ n = find (cellfun ("isclass", args, "struct")); if (! isempty (n)) f = fieldnames (args{n}); - for m = 1:numel(f) + for m = 1:numel (f) opts.(f{m}) = args{n}.(f{m}); endfor args(n) = []; endif - for n = 1:2:numel(args) + for n = 1:2:numel (args) opts.(args{n}) = args{n+1}; endfor diff --git a/scripts/plot/private/__gnuplot_print__.m b/scripts/plot/private/__gnuplot_print__.m --- a/scripts/plot/private/__gnuplot_print__.m +++ b/scripts/plot/private/__gnuplot_print__.m @@ -151,7 +151,7 @@ opts.pipeline = pipeline; - for n = 1:numel(pipeline) + for n = 1:numel (pipeline) if (opts.debug) fprintf ("gnuplot-pipeline: '%s'\n", pipeline{n}); endif @@ -170,12 +170,12 @@ function eps_drawnow (opts, epsfile, gp_opts) [h, fontsize] = get_figure_text_objs (opts); unwind_protect - for n = 1:numel(h) + for n = 1:numel (h) set (h(n), "fontsize", 2 * fontsize{n}); endfor local_drawnow (sprintf ("postscript eps %s", gp_opts), epsfile, opts); unwind_protect_cleanup - for n = 1:numel(h) + for n = 1:numel (h) set (h(n), "fontsize", fontsize{n}); endfor end_unwind_protect @@ -196,7 +196,7 @@ endfunction function f = font_spec (opts, varargin) - for n = 1:2:numel(varargin) + for n = 1:2:numel (varargin) opts.(varargin{n}) = varargin{n+1}; endfor f = ""; diff --git a/scripts/plot/private/__go_draw_axes__.m b/scripts/plot/private/__go_draw_axes__.m --- a/scripts/plot/private/__go_draw_axes__.m +++ b/scripts/plot/private/__go_draw_axes__.m @@ -90,7 +90,7 @@ x = [1, 1]; else ## 3D plots need to be sized down to fit in the window. - x = 1.0 ./ sqrt([2, 2.5]); + x = 1.0 ./ sqrt ([2, 2.5]); endif fprintf (plot_stream, "set tmargin screen %.15g;\n", pos(2)+pos(4)/2+x(2)*pos(4)/2); @@ -574,7 +574,7 @@ ydat = obj.ydata(:); data{data_idx} = [xdat, ydat]'; usingclause{data_idx} = sprintf ("record=%d using ($1):($2) axes %s%s", - rows(xdat), xaxisloc_using, yaxisloc_using); + rows (xdat), xaxisloc_using, yaxisloc_using); endif style = do_linestyle_command (obj, obj.color, data_idx, mono, @@ -714,7 +714,7 @@ if (nd == 3 && numel (xcol) == 3) ccdat = ccol; if (! isvector (ccdat)) - tmp = rows(cmap) + rows(addedcmap) + ... + tmp = rows (cmap) + rows (addedcmap) + ... [1 : rows(ccdat)]; addedcmap = [addedcmap; ccdat]; ccdat = tmp(:); @@ -746,7 +746,7 @@ if (nd == 3 && numel (xcol) == 3) if (isnan (ccdat)) - ccdat = (rows (cmap) + rows(addedcmap) + 1) * ones(3, 1); + ccdat = (rows (cmap) + rows (addedcmap) + 1) * ones(3, 1); addedcmap = [addedcmap; reshape(color, 1, 3)]; endif data{data_3d_idx} = [data{data_3d_idx}, ... @@ -827,22 +827,22 @@ ccol = cdat; endif if (strncmp (ec, "flat", 4)) - if (numel(ccol) == 3) + if (numel (ccol) == 3) color = ccol; else if (isscalar (ccol)) - ccol = repmat(ccol, numel (xcol), 1); + ccol = repmat (ccol, numel (xcol), 1); endif color = "flat"; have_cdata(data_idx) = true; endif elseif (strncmp (ec, "interp", 6)) - if (numel(ccol) == 3) + if (numel (ccol) == 3) warning ("\"interp\" not supported, using 1st entry of cdata"); color = ccol(1,:); else if (isscalar (ccol)) - ccol = repmat(ccol, numel (xcol), 1); + ccol = repmat (ccol, numel (xcol), 1); endif color = "interp"; have_cdata(data_idx) = true; @@ -877,7 +877,7 @@ endif if (isfield (obj, "linewidth")) - lw = sprintf("linewidth %f", obj.linewidth); + lw = sprintf ("linewidth %f", obj.linewidth); else lw = ""; endif @@ -923,7 +923,7 @@ else m = mdat; endif - ps = sprintf("pointsize %f", m / 3); + ps = sprintf ("pointsize %f", m / 3); else ps = ""; endif @@ -950,7 +950,7 @@ else m = mdat; endif - ps = sprintf("pointsize %f", m / 3); + ps = sprintf ("pointsize %f", m / 3); else ps = ""; endif @@ -977,7 +977,7 @@ else m = mdat; endif - ps = sprintf("pointsize %f", m / 3); + ps = sprintf ("pointsize %f", m / 3); else ps = ""; endif @@ -987,7 +987,7 @@ endif else if (!isempty (style)) - if (length(tmpwith) < sidx || isempty (tmpwith{sidx})) + if (length (tmpwith) < sidx || isempty (tmpwith{sidx})) tmpwith{sidx} = sprintf ("with %s %s %s %s", style, lw, lt, colorspec); @@ -1012,7 +1012,7 @@ else m = mdat; endif - ps = sprintf("pointsize %f", m / 3); + ps = sprintf ("pointsize %f", m / 3); else ps = ""; endif @@ -1122,7 +1122,7 @@ cdat = obj.cdata; err = false; - if (! size_equal(zdat, cdat)) + if (! size_equal (zdat, cdat)) err = true; endif if (isvector (xdat) && isvector (ydat) && ismatrix (zdat)) @@ -1188,11 +1188,11 @@ if (all (obj.facecolor == 1)) hidden_removal = true; endif - fputs(plot_stream,"unset pm3d;\n"); - fputs(plot_stream,"set style increment user;\n"); + fputs (plot_stream,"unset pm3d;\n"); + fputs (plot_stream,"set style increment user;\n"); withpm3d = false; - withclause{data_idx} = sprintf("with %s linestyle %d", - style{1}, data_idx); + withclause{data_idx} = sprintf ("with %s linestyle %d", + style{1}, data_idx); fputs (plot_stream, "unset pm3d\n"); endif @@ -1267,7 +1267,7 @@ style{3}, data_idx); endif if (withpm3d && strncmp (style {1}, "linespoints", 11)) - if (isempty(zz)) + if (isempty (zz)) len = 3 * xlen; zz = zeros (ylen, len); k = 1; @@ -1335,7 +1335,7 @@ ## Gnuplot's Character units are different for x/y and vary with fontsize. The aspect ratio ## of 1:1.7 was determined by experiment to work for eps/ps/etc. For the MacOS aqua terminal ## a value of 2.5 is needed. However, the difference is barely noticable. - dx_and_dy = [(-dy * sind (angle)), (dy * cosd(angle))] .* [1.7 1]; + dx_and_dy = [(-dy * sind (angle)), (dy * cosd (angle))] .* [1.7 1]; ## FIXME - Multiline text produced the gnuplot "warning: ft_render: skipping glyph" if (nd == 3) @@ -1376,7 +1376,7 @@ fputs (plot_stream, "set pm3d explicit;\n"); endif - if (isnan(hidden_removal) || hidden_removal) + if (isnan (hidden_removal) || hidden_removal) fputs (plot_stream, "set hidden3d;\n"); else fputs (plot_stream, "unset hidden3d;\n"); @@ -1425,17 +1425,17 @@ endif cmap = parent_figure_obj.colormap; - cmap_sz = rows(cmap); + cmap_sz = rows (cmap); if (! any (isinf (clim))) if (truecolor || ! cdatadirect) - if (rows(addedcmap) > 0) + if (rows (addedcmap) > 0) for i = 1:data_idx if (have_3d_patch(i)) data{i}(end,:) = clim(2) * (data{i}(end, :) - 0.5) / cmap_sz; endif endfor fprintf (plot_stream, "set cbrange [%.15e:%.15e];\n", clim(1), clim(2) * - (cmap_sz + rows(addedcmap)) / cmap_sz); + (cmap_sz + rows (addedcmap)) / cmap_sz); else fprintf (plot_stream, "set cbrange [%.15e:%.15e];\n", clim); endif @@ -1590,8 +1590,8 @@ fputs (plot_stream, "set style data lines;\n"); cmap = [cmap; addedcmap]; - cmap_sz = cmap_sz + rows(addedcmap); - if (length(cmap) > 0) + cmap_sz = cmap_sz + rows (addedcmap); + if (length (cmap) > 0) fprintf (plot_stream, "set palette positive color model RGB maxcolors %i;\n", cmap_sz); @@ -1629,7 +1629,7 @@ if (numel (is_image_data) > 1 && is_image_data(2)) ## Remove terminating semicolon n = max (strfind (withclause{1}, ";")); - if (! isempty(n)) + if (! isempty (n)) withclause{1} = withclause{1}(1:n-1); endif endif @@ -1657,7 +1657,7 @@ if (numel (is_image_data) > i && is_image_data(i+1)) ## Remove terminating semicolon n = max (strfind (withclause{i}, ";")); - if (! isempty(n)) + if (! isempty (n)) withclause{i} = withclause{i}(1:n-1); endif endif @@ -1690,7 +1690,7 @@ ## Can't write 3d patch data as binary as can't plot more than ## a single patch at a time and have to plot all patches together ## so that the gnuplot depth ordering is done correctly - for j = 1 : 4 : columns(data{i}) + for j = 1 : 4 : columns (data{i}) if (j != 1) fputs (plot_stream, "\n\n"); endif @@ -2097,7 +2097,7 @@ fontname, fontspec, interpreter, scale, sgn, gnuplot_term) persistent warned_latex = false; if (strcmpi (interpreter, "tex")) - for n = 1 : numel(labels) + for n = 1 : numel (labels) labels{n} = __tex2enhanced__ (labels{n}, fontname, false, false); endfor elseif (strcmpi (interpreter, "latex")) @@ -2147,7 +2147,7 @@ tickdir, ticklength, axispos); endif - labels = regexprep(labels, '%', "%%"); + labels = regexprep (labels, '%', "%%"); for i = 1:ntics fprintf (plot_stream, " \"%s\" %.15g", labels{k++}, tics(i)); if (i < ntics) @@ -2237,7 +2237,7 @@ it = false; bld = false; if (! isempty (t.fontweight) && strcmpi (t.fontweight, "bold")) - if (! isempty(t.fontangle) + if (! isempty (t.fontangle) && (strcmpi (t.fontangle, "italic") || strcmpi (t.fontangle, "oblique"))) f = cstrcat (f, "-bolditalic"); @@ -2247,7 +2247,7 @@ f = cstrcat (f, "-bold"); bld = true; endif - elseif (! isempty(t.fontangle) + elseif (! isempty (t.fontangle) && (strcmpi (t.fontangle, "italic") || strcmpi (t.fontangle, "oblique"))) f = cstrcat (f, "-italic"); @@ -2282,7 +2282,7 @@ str = cellstr (num2str (str(:))); endif if (iscellstr (str)) - for n = 1:numel(str) + for n = 1:numel (str) if (isnumeric (str{n})) str{n} = num2str (str{n}); endif @@ -2293,7 +2293,7 @@ if (enhanced) if (strcmpi (obj.interpreter, "tex")) if (iscellstr (str)) - for n = 1:numel(str) + for n = 1:numel (str) str{n} = __tex2enhanced__ (str{n}, fnt, it, bld); endfor else @@ -2317,14 +2317,14 @@ labels = cellstr (str); endif for marker = "_^" - for m = 1 : numel(labels) + for m = 1 : numel (labels) n1 = strfind (labels{m}, sprintf ("\\%s", marker)); n2 = strfind (labels{m}, marker); if (! isempty (n1)) n1 = n1 + 1; n2 = setdiff (n2, n1); endif - for n = numel(n2):-1:1 + for n = numel (n2):-1:1 labels{m} = [labels{m}(1:n2(n)-1), "\\", labels{m}(n2(n):end)]; endfor endfor @@ -2340,7 +2340,7 @@ persistent sym = __setup_sym_table__ (); persistent flds = fieldnames (sym); - [s, e, m] = regexp(str,'\\\\([a-zA-Z]+|0)','start','end','matches'); + [s, e, m] = regexp (str,'\\\\([a-zA-Z]+|0)','start','end','matches'); for i = length (s) : -1 : 1 ## special case for "\0" and replace with "{/Symbol \306}' @@ -2349,7 +2349,7 @@ else f = m{i}(2:end); if (isfield (sym, f)) - g = getfield(sym, f); + g = getfield (sym, f); ## FIXME The symbol font doesn't seem to support bold or italic ##if (bld) ## if (it) @@ -2369,54 +2369,54 @@ it = true; if (bld) str = cstrcat (str(1:s(i) - 1), '/', fnt, '-bolditalic ', - str(s(i) + 3:end)); + str(s(i) + 3:end)); else str = cstrcat (str(1:s(i) - 1), '/', fnt, '-italic ', - str(s(i) + 3:end)); + str(s(i) + 3:end)); endif elseif (strncmp (f, "bf", 2)) bld = true; if (it) str = cstrcat (str(1:s(i) - 1), '/', fnt, '-bolditalic ', - str(2(i) + 3:end)); + str(2(i) + 3:end)); else str = cstrcat (str(1:s(i) - 1), '/', fnt, '-bold ', - str(s(i) + 3:end)); + str(s(i) + 3:end)); endif elseif (strcmpi (f, "color")) ## FIXME Ignore \color but remove trailing {} block as well - d = strfind(str(e(i) + 1:end),'}'); + d = strfind (str(e(i) + 1:end),'}'); if (isempty (d)) warning ('syntax error in \color argument'); else str = cstrcat (str(1:s(i) - 1), str(e(i) + d + 1:end)); endif - elseif(strcmpi (f, "fontname")) - b1 = strfind(str(e(i) + 1:end),'{'); - b2 = strfind(str(e(i) + 1:end),'}'); - if (isempty(b1) || isempty(b2)) + elseif (strcmpi (f, "fontname")) + b1 = strfind (str(e(i) + 1:end),'{'); + b2 = strfind (str(e(i) + 1:end),'}'); + if (isempty (b1) || isempty (b2)) warning ('syntax error in \fontname argument'); else str = cstrcat (str(1:s(i) - 1), '/', - str(e(i)+b1(1) + 1:e(i)+b2(1)-1), '{}', - str(e(i) + b2(1) + 1:end)); + str(e(i)+b1(1) + 1:e(i)+b2(1)-1), '{}', + str(e(i) + b2(1) + 1:end)); endif - elseif(strcmpi (f, "fontsize")) - b1 = strfind(str(e(i) + 1:end),'{'); - b2 = strfind(str(e(i) + 1:end),'}'); - if (isempty(b1) || isempty(b2)) + elseif (strcmpi (f, "fontsize")) + b1 = strfind (str(e(i) + 1:end),'{'); + b2 = strfind (str(e(i) + 1:end),'}'); + if (isempty (b1) || isempty (b2)) warning ('syntax error in \fontname argument'); else str = cstrcat (str(1:s(i) - 1), '/=', - str(e(i)+b1(1) + 1:e(i)+b2(1)-1), '{}', - str(e(i) + b2(1) + 1:end)); + str(e(i)+b1(1) + 1:e(i)+b2(1)-1), '{}', + str(e(i) + b2(1) + 1:end)); endif else ## Last desperate attempt to treat the symbol. Look for things ## like \pix, that should be translated to the symbol Pi and x for j = 1 : length (flds) if (strncmp (flds{j}, f, length (flds{j}))) - g = getfield(sym, flds{j}); + g = getfield (sym, flds{j}); ## FIXME The symbol font doesn't seem to support bold or italic ##if (bld) ## if (it) @@ -2428,7 +2428,7 @@ ## g = regexprep (g, '/Symbol', '/Symbol-italic'); ##endif str = cstrcat (str(1:s(i) - 1), g, - str(s(i) + length (flds{j}) + 1:end)); + str(s(i) + length (flds{j}) + 1:end)); break; endif endfor @@ -2444,15 +2444,15 @@ ## FIXME -- This is a mess... Is it worth it just for a "@" character? - [s, m] = regexp(str,'[_\^]','start','matches'); + [s, m] = regexp (str,'[_\^]','start','matches'); i = 1; p = 0; while (i < length (s)) - if (i < length(s)) + if (i < length (s)) if (str(s(i) + p + 1) == "{") - s1 = strfind(str(s(i) + p + 2:end),'{'); + s1 = strfind (str(s(i) + p + 2:end),'{'); si = 1; - l1 = strfind(str(s(i) + p + 1:end),'}'); + l1 = strfind (str(s(i) + p + 1:end),'}'); li = 1; while (li <= length (l1) && si <= length (s1)) if (l1(li) < s1(si)) @@ -2464,12 +2464,12 @@ si++; endif endwhile - l1 = l1 (min (length(l1), si)); + l1 = l1 (min (length (l1), si)); if (s(i) + l1 + 1 == s(i+1)) if (str(s(i + 1) + p + 1) == "{") - s2 = strfind(str(s(i + 1) + p + 2:end),'{'); + s2 = strfind (str(s(i + 1) + p + 2:end),'{'); si = 1; - l2 = strfind(str(s(i + 1) + p + 1:end),'}'); + l2 = strfind (str(s(i + 1) + p + 1:end),'}'); li = 1; while (li <= length (l2) && si <= length (s2)) if (l2(li) < s2(si)) @@ -2481,20 +2481,20 @@ si++; endif endwhile - l2 = l2 (min (length(l2), si)); + l2 = l2 (min (length (l2), si)); if (length_string (str(s(i)+p+2:s(i)+p+l1-1)) <= - length_string(str(s(i+1)+p+2:s(i+1)+p+l2-1))) + length_string (str(s(i+1)+p+2:s(i+1)+p+l2-1))) ## Shortest already first! str = cstrcat (str(1:s(i)+p-1), "@", str(s(i)+p:end)); else ## Have to swap sub/super-script to get shortest first. str = cstrcat (str(1:s(i)+p-1), "@", str(s(i+1)+p:s(i+1)+p+l2), - str(s(i)+p:s(i)+p+l1), str(s(i+1)+p+l2+1:end)); + str(s(i)+p:s(i)+p+l1), str(s(i+1)+p+l2+1:end)); endif else ## Have to swap sub/super-script to get shortest first. str = cstrcat (str(1:s(i)+p-1), "@", str(s(i+1)+p:s(i+1)+p+1), - str(s(i)+p:s(i)+p+l1), str(s(i+1)+p+2:end)); + str(s(i)+p:s(i)+p+l1), str(s(i+1)+p+2:end)); endif i += 2; p ++; @@ -2519,7 +2519,7 @@ endfunction function l = length_string (s) - l = length (s) - length (strfind(s,'{')) - length (strfind(s,'}')); + l = length (s) - length (strfind (s,'{')) - length (strfind (s,'}')); m = regexp (s, '/([\w-]+|[\w-]+=\d+)', 'matches'); if (!isempty (m)) l = l - sum (cellfun ("length", m)); diff --git a/scripts/plot/private/__go_draw_figure__.m b/scripts/plot/private/__go_draw_figure__.m --- a/scripts/plot/private/__go_draw_figure__.m +++ b/scripts/plot/private/__go_draw_figure__.m @@ -158,12 +158,12 @@ ## to __go_draw_axes__ hlegend = []; fkids = get (h, "children"); - for j = 1 : numel(fkids) + for j = 1 : numel (fkids) if (ishandle (fkids (j)) && strcmp (get (fkids (j), "type"), "axes") && (strcmp (get (fkids (j), "tag"), "legend"))) udata = get (fkids (j), "userdata"); - if (isscalar(udata.handle) + if (isscalar (udata.handle) && ! isempty (intersect (udata.handle, kids (i)))) hlegend = get (fkids (j)); break; diff --git a/scripts/plot/private/__interp_cube__.m b/scripts/plot/private/__interp_cube__.m --- a/scripts/plot/private/__interp_cube__.m +++ b/scripts/plot/private/__interp_cube__.m @@ -23,7 +23,7 @@ ## Undocumented internal function. ## @end deftypefn -function [Vxyz, idx, frac] = __interp_cube__(x, y, z, val, v, req = "values" ) +function [Vxyz, idx, frac] = __interp_cube__ (x, y, z, val, v, req = "values" ) if (ismatrix (x) && ndims (x) == 3 && ismatrix (y) && ndims (y) == 3 ... && ismatrix (z) && ndims (z) == 3 && size_equal (x, y, z, val)) x = squeeze (x(1,:,1))(:); @@ -34,7 +34,7 @@ y = y(:); z = z(:); else - error("__interp_cube__: X, Y, Z have wrong dimensions"); + error ("__interp_cube__: X, Y, Z have wrong dimensions"); endif if (size (val) != [length(x), length(y), length(z)]) error ("__interp_cube__: VAL has wrong dimensions"); @@ -101,7 +101,7 @@ endswitch endfunction -function [Vxyz, idx, frac] = interp_cube_trilin(x, y, z, val, v) +function [Vxyz, idx, frac] = interp_cube_trilin (x, y, z, val, v) [idx, frac] = cube_idx (x(:), y(:), z(:), v); sval = size (val); i000 = sub2ind (sval, idx(:, 1), idx(:, 2), idx(:, 3)); @@ -126,7 +126,7 @@ val( i111 ) .* Bx .* By .* Bz; endfunction -function [Dx, Dy, Dz, idx, frac] = interp_cube_trilin_grad(x, y, z, val, v) +function [Dx, Dy, Dz, idx, frac] = interp_cube_trilin_grad (x, y, z, val, v) [idx, frac] = cube_idx (x(:), y(:), z(:), v); sval = size (val); i000 = sub2ind (sval, idx(:, 1), idx(:, 2), idx(:, 3)); @@ -169,7 +169,7 @@ val( i111 ) .* Bx .* By; endfunction -function [idx, frac] = cube_idx(x, y, z, v) +function [idx, frac] = cube_idx (x, y, z, v) idx = zeros (size (v)); frac = zeros (size (v)); idx(:, 2) = lookup (x(2:end-1), v(:, 1)) + 1; diff --git a/scripts/plot/private/__marching_cube__.m b/scripts/plot/private/__marching_cube__.m --- a/scripts/plot/private/__marching_cube__.m +++ b/scripts/plot/private/__marching_cube__.m @@ -205,7 +205,7 @@ endfor endfunction -function p = vertex_interp(isolevel,p1x, p1y, p1z,... +function p = vertex_interp (isolevel,p1x, p1y, p1z,... p2x, p2y, p2z,valp1,valp2, col1, col2) if (nargin == 9) diff --git a/scripts/plot/private/__patch__.m b/scripts/plot/private/__patch__.m --- a/scripts/plot/private/__patch__.m +++ b/scripts/plot/private/__patch__.m @@ -40,12 +40,12 @@ elseif (isstruct (varargin{1})) if (isfield (varargin{1}, "vertices") && isfield (varargin{1}, "faces")) args{1} = "faces"; - args{2} = getfield(varargin{1}, "faces"); + args{2} = getfield (varargin{1}, "faces"); args{3} = "vertices"; - args{4} = getfield(varargin{1}, "vertices"); + args{4} = getfield (varargin{1}, "vertices"); args{5} = "facevertexcdata"; if (isfield (varargin{1}, "facevertexcdata")) - args{6} = getfield(varargin{1}, "facevertexcdata"); + args{6} = getfield (varargin{1}, "facevertexcdata"); else args{6} = []; endif @@ -209,7 +209,7 @@ endif endfunction -function args = delfields(args, flds) +function args = delfields (args, flds) idx = cellfun (@(x) any (strcmpi (x, flds)), args); if (rows (idx) == 1) idx = idx | [false, idx(1:end-1)]; @@ -237,13 +237,13 @@ vert = args {idx}; endif idx = find (strcmpi (args, "facevertexcdata"), 1, "last") + 1; - if (isempty(idx) || idx > nargs) + if (isempty (idx) || idx > nargs) fvc = []; else fvc = args {idx}; endif idx = find (strcmpi (args, "facecolor"), 1, "last") + 1; - if (isempty(idx) || idx > nargs) + if (isempty (idx) || idx > nargs) if (!isempty (fvc)) fc = "flat"; else @@ -261,19 +261,19 @@ endfor x = reshape (vert(:,1)(idx), size (idx)); y = reshape (vert(:,2)(idx), size (idx)); - if (size(vert,2) > 2) + if (columns (vert) > 2) z = reshape (vert(:,3)(idx), size (idx)); else z = []; endif - if (size(fvc, 1) == nc || size (fvc, 1) == 1) + if (rows (fvc) == nc || rows (fvc) == 1) c = reshape (fvc, [1, size(fvc)]); else - if (size(fvc, 2) == 3) - c = cat(3, reshape (fvc(idx, 1), size(idx)), - reshape (fvc(idx, 2), size(idx)), - reshape (fvc(idx, 3), size(idx))); + if (columns (fvc) == 3) + c = cat (3, reshape (fvc(idx, 1), size (idx)), + reshape (fvc(idx, 2), size (idx)), + reshape (fvc(idx, 3), size (idx))); elseif (isempty (fvc)) c = []; else ## if (size (fvc, 2) == 1) @@ -301,19 +301,19 @@ y = args {idx}; endif idx = find (strcmpi (args, "zdata"), 1, "last") + 1; - if (isempty(idx) || idx > nargs) + if (isempty (idx) || idx > nargs) z = []; else z = args {idx}; endif idx = find (strcmpi (args, "cdata"), 1, "last") + 1; - if (isempty(idx) || idx > nargs) + if (isempty (idx) || idx > nargs) c = []; else c = args {idx}; endif idx = find (strcmpi (args, "facecolor"), 1, "last") + 1; - if (isempty(idx) || idx > nargs) + if (isempty (idx) || idx > nargs) if (!isempty (c)) fc = "flat"; else @@ -332,11 +332,11 @@ else vert = [x(:), y(:)]; endif - faces = reshape (1:numel(x), nr, nc); + faces = reshape (1:numel (x), nr, nc); faces = faces'; if (ndims (c) == 3) - fvc = reshape (c, size (c, 1) * size (c, 2), size(c, 3)); + fvc = reshape (c, size (c, 1) * size (c, 2), size (c, 3)); else fvc = c(:); endif diff --git a/scripts/plot/private/__pie__.m b/scripts/plot/private/__pie__.m --- a/scripts/plot/private/__pie__.m +++ b/scripts/plot/private/__pie__.m @@ -123,10 +123,10 @@ sc = i * ones (size (sz)); hlist = [hlist; - patch(xoff + [0, - sind(xn)], yoff + [0, cosd(xn)], zeros (1, ln + 1), i); - surface(sx, sy, sz, sc); - patch(xoff + [0, - sind(xn)], yoff + [0, cosd(xn)], zlvl * ones (1, ln + 1), i); - text(xt, yt, zlvl, labels{i})]; + patch (xoff + [0, - sind(xn)], yoff + [0, cosd(xn)], zeros (1, ln + 1), i); + surface (sx, sy, sz, sc); + patch (xoff + [0, - sind(xn)], yoff + [0, cosd(xn)], zlvl * ones (1, ln + 1), i); + text (xt, yt, zlvl, labels{i})]; elseif (strncmp (caller, "pie", 3)) if (xt > 0) @@ -136,14 +136,14 @@ endif hlist = [hlist; patch(xoff + [0, - sind(xn)], yoff + [0, cosd(xn)], i); - text(xt, yt, labels{i}, "horizontalalignment", align)]; + text (xt, yt, labels{i}, "horizontalalignment", align)]; else error ("__pie__: unknown caller `%s'", caller); endif endfor - addlistener(gca, "view", {@update_text_pos, hlist}); + addlistener (gca, "view", {@update_text_pos, hlist}); if (strncmp (caller, "pie3", 4)) axis ([-1.25, 1.25, -1.25, 1.25, -0.05, 0.4], "equal", "off"); diff --git a/scripts/plot/private/__plt__.m b/scripts/plot/private/__plt__.m --- a/scripts/plot/private/__plt__.m +++ b/scripts/plot/private/__plt__.m @@ -38,7 +38,7 @@ hlegend = []; fkids = get (gcf (), "children"); - for i = 1 : numel(fkids) + for i = 1 : numel (fkids) if (ishandle (fkids (i)) && strcmp (get (fkids (i), "type"), "axes") && (strcmp (get (fkids (i), "tag"), "legend"))) udata = get (fkids (i), "userdata"); diff --git a/scripts/plot/private/__print_parse_opts__.m b/scripts/plot/private/__print_parse_opts__.m --- a/scripts/plot/private/__print_parse_opts__.m +++ b/scripts/plot/private/__print_parse_opts__.m @@ -77,7 +77,7 @@ varargin(1) = []; endif - for i = 1:numel(varargin) + for i = 1:numel (varargin) arg = strtrim (varargin{i}); if (ischar (arg)) if (strcmp (arg, "-color")) diff --git a/scripts/plot/private/__quiver__.m b/scripts/plot/private/__quiver__.m --- a/scripts/plot/private/__quiver__.m +++ b/scripts/plot/private/__quiver__.m @@ -43,9 +43,9 @@ v = varargin{ioff++}; if (is3d) w = varargin{ioff++}; - [x, y, z] = meshgrid (1:size(u,2), 1:size(u,1), 1:max(size(w))); + [x, y, z] = meshgrid (1:size (u,2), 1:size (u,1), 1:max (size (w))); else - [x, y] = meshgrid (1:size(u,2), 1:size(u,1)); + [x, y] = meshgrid (1:size (u,2), 1:size (u,1)); endif if (nargin >= ioff && isnumeric (varargin{ioff}) && isscalar (varargin{ioff})) @@ -62,7 +62,7 @@ if (is3d) w = varargin{ioff++}; if (isvector (x) && isvector (y) && isvector (z) - && (! isvector (u) || ! isvector (v) || ! isvector(w))) + && (! isvector (u) || ! isvector (v) || ! isvector (w))) [x, y, z] = meshgrid (x, y, z); endif else @@ -112,10 +112,10 @@ else [nx, ny] = size (x); endif - dx = (max(x(:)) - min(x(:))) ./ nx; - dy = (max(y(:)) - min(y(:))) ./ ny; + dx = (max (x(:)) - min (x(:))) ./ nx; + dy = (max (y(:)) - min (y(:))) ./ ny; if (is3d) - dz = (max(z(:)) - min(z(:))) ./ max (size (z)); + dz = (max (z(:)) - min (z(:))) ./ max (size (z)); len = max (sqrt (u(:).^2 + v(:).^2 + w(:).^2)); else dz = 0; @@ -124,7 +124,7 @@ if (len > 0) sd = sqrt (dx.^2 + dy.^2 + dz.^2) / len; if (sd != 0) - s = sqrt(2) * autoscale * sd; + s = sqrt (2) * autoscale * sd; else # special case of identical points with multiple vectors s = autoscale; endif @@ -349,10 +349,10 @@ else [nx, ny] = size (x); endif - dx = (max(x(:)) - min(x(:))) ./ nx; - dy = (max(y(:)) - min(y(:))) ./ ny; + dx = (max (x(:)) - min (x(:))) ./ nx; + dy = (max (y(:)) - min (y(:))) ./ ny; if (is3d) - dz = (max(z(:)) - min(z(:))) ./ max (size (z)); + dz = (max (z(:)) - min (z(:))) ./ max (size (z)); len = max (sqrt (u(:).^2 + v(:).^2 + w(:).^2)); else dz = 0; @@ -361,7 +361,7 @@ if (len > 0) sd = sqrt (dx.^2 + dy.^2 + dz.^2) / len; if (sd != 0) - s *= sqrt(2) * sd; + s *= sqrt (2) * sd; endif u = s * u; v = s * v; diff --git a/scripts/plot/private/__scatter__.m b/scripts/plot/private/__scatter__.m --- a/scripts/plot/private/__scatter__.m +++ b/scripts/plot/private/__scatter__.m @@ -32,13 +32,13 @@ if (nd == 3) z = varargin{6}(:); - idx = isnan(x) | isnan (y) | isnan (z); + idx = isnan (x) | isnan (y) | isnan (z); x (idx) = []; y (idx) = []; z (idx) = []; istart = 7; else - idx = isnan(x) | isnan (y); + idx = isnan (x) | isnan (y); x (idx) = []; y (idx) = []; z = zeros (length (x), 0); @@ -140,7 +140,7 @@ ## For small number of points, we'll construct an object for each point. if (numel (s) == 1) - s = repmat (s, numel(x), 1); + s = repmat (s, numel (x), 1); endif if (one_explicit_color) @@ -222,11 +222,11 @@ if (! ischar (c) && rows (c) > 1) ax = get (hg, "parent"); clim = get (ax, "clim"); - if (min(c(:)) < clim(1)) - clim(1) = min(c(:)); + if (min (c(:)) < clim(1)) + clim(1) = min (c(:)); set (ax, "clim", clim); endif - if (max(c(:)) > clim(2)) + if (max (c(:)) > clim(2)) set (ax, "clim", [clim(1), max(c(:))]); endif endif @@ -259,7 +259,7 @@ endfunction -function h = render_size_color(hg, vert, s, c, marker, filled, isflat) +function h = render_size_color (hg, vert, s, c, marker, filled, isflat) if (isscalar (s)) x = vert(:,1); y = vert(:,2); @@ -273,7 +273,7 @@ if (ischar (c) || ! isflat || gnuplot_hack) if (filled) h = __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z, - "faces", 1:numel(x), "vertices", vert, + "faces", 1:numel (x), "vertices", vert, "facecolor", "none", "edgecolor", "none", "marker", marker, "markeredgecolor", "none", @@ -281,7 +281,7 @@ "markersize", s, "linestyle", "none"); else h = __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z, - "faces", 1:numel(x), "vertices", vert, + "faces", 1:numel (x), "vertices", vert, "facecolor", "none", "edgecolor", "none", "marker", marker, "markeredgecolor", c(1,:), @@ -291,7 +291,7 @@ else if (filled) h = __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z, - "faces", 1:numel(x), "vertices", vert, + "faces", 1:numel (x), "vertices", vert, "facecolor", "none", "edgecolor", "none", "marker", marker, "markersize", s, "markeredgecolor", "none", @@ -300,7 +300,7 @@ "linestyle", "none"); else h = __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z, - "faces", 1:numel(x), "vertices", vert, + "faces", 1:numel (x), "vertices", vert, "facecolor", "none", "edgecolor", "none", "marker", marker, "markersize", s, "markeredgecolor", "flat", @@ -362,14 +362,14 @@ if (isempty (z1)) for i = 1 : length (hlist) set (hlist(i), "vertices", [x1(i), y1(i)], "cdata", - reshape(c1(i,:),[1, size(c1)(2:end)]), + reshape (c1(i,:),[1, size(c1)(2:end)]), "facevertexcdata", c1(i,:), "markersize", size1(i)); endfor else for i = 1 : length (hlist) set (hlist(i), "vertices", [x1(i), y1(i), z1(i)], "cdata", - reshape(c1(i,:),[1, size(c1)(2:end)]), + reshape (c1(i,:),[1, size(c1)(2:end)]), "facevertexcdata", c1(i,:), "markersize", size1(i)); endfor diff --git a/scripts/plot/private/__stem__.m b/scripts/plot/private/__stem__.m --- a/scripts/plot/private/__stem__.m +++ b/scripts/plot/private/__stem__.m @@ -147,7 +147,7 @@ if (! isempty (args)) set (hg, args{:}); endif - if (i == 1 && !isempty(h_baseline)) + if (i == 1 && ! isempty (h_baseline)) set (h_baseline, "parent", get (hg, "parent")); endif endfor @@ -296,7 +296,7 @@ error ("stem: X and Y must be matrices"); endif endif - endif # if ischar(varargin{2}) + endif # if ischar (varargin{2}) if (! have_z) ## varargin{3} must be char. ## Check for "fill. @@ -436,7 +436,7 @@ [lc, ls, mc, ms] = set_default_values (); ## Parse the line specifier string. cur_props = __pltopt__ ("stem", str, false); - for i = 1:length(cur_props) + for i = 1:length (cur_props) if (isfield (cur_props(i), "color") && ! isempty (cur_props(i).color)); # means line color mc = lc = cur_props(i).color; elseif (isfield (cur_props(i), "linestyle")) @@ -508,7 +508,7 @@ endif kids = get (h, "children"); - yt = get(h, "ydata")(:)'; + yt = get (h, "ydata")(:)'; ny = length (yt); yt = [b0 * ones(1, ny); yt; NaN(1, ny)](:); set (kids(2), "ydata", yt); @@ -532,7 +532,7 @@ if (!isempty (z) && size_equal (x, y, z)) error ("stem3: inconsistent size of x, y and z"); - elseif (numel(x) != numel (y)) + elseif (numel (x) != numel (y)) error ("stem: inconsistent size of x and y"); else bl = get (h, "basevalue"); diff --git a/scripts/plot/private/__tight_eps_bbox__.m b/scripts/plot/private/__tight_eps_bbox__.m --- a/scripts/plot/private/__tight_eps_bbox__.m +++ b/scripts/plot/private/__tight_eps_bbox__.m @@ -58,12 +58,12 @@ looking_for_bbox = true; while (looking_for_bbox) current_line = fgetl (fid); - if (strncmpi (current_line, box_string, numel(box_string))) + if (strncmpi (current_line, box_string, numel (box_string))) line_length = numel (current_line); num_spaces = line_length - numel (tight_bbox_line); if (numel (current_line) >= numel (tight_bbox_line)) new_line = tight_bbox_line; - new_line(end+1:numel(current_line)) = " "; + new_line(end+1:numel (current_line)) = " "; bbox_replaced = true; ## Back up to the beginning of the line (include EOL characters). if (ispc ()) @@ -113,12 +113,12 @@ function bbox_line = get_bbox (lines) box_string = "%%BoundingBox:"; pattern = strcat (box_string, "[^%]*"); - pattern = pattern(1:find(double(pattern)>32, 1, "last")); + pattern = pattern(1:find (double (pattern) > 32, 1, "last")); bbox_line = regexp (lines, pattern, "match"); if (iscell (bbox_line)) bbox_line = bbox_line{1}; endif ## Remove the EOL characters. - bbox_line(double(bbox_line)<32) = ""; + bbox_line(double (bbox_line) < 32) = ""; endfunction diff --git a/scripts/plot/private/__uigetdir_fltk__.m b/scripts/plot/private/__uigetdir_fltk__.m --- a/scripts/plot/private/__uigetdir_fltk__.m +++ b/scripts/plot/private/__uigetdir_fltk__.m @@ -25,7 +25,7 @@ function dirname = __uigetdir_fltk__ (start_path, dialog_title) - if (exist("__fltk_uigetfile__") != 3) + if (exist ("__fltk_uigetfile__") != 3) error ("uigetdir: fltk graphics toolkit required"); endif diff --git a/scripts/plot/private/__uigetfile_fltk__.m b/scripts/plot/private/__uigetfile_fltk__.m --- a/scripts/plot/private/__uigetfile_fltk__.m +++ b/scripts/plot/private/__uigetfile_fltk__.m @@ -25,7 +25,7 @@ function [retval, retpath, retindex] = __uigetfile_fltk__ (filters, title, defval, position, multiselect, defdir) - if (exist("__fltk_uigetfile__") != 3) + if (exist ("__fltk_uigetfile__") != 3) error ("uigetfile: fltk graphics toolkit required"); endif diff --git a/scripts/plot/private/__uiputfile_fltk__.m b/scripts/plot/private/__uiputfile_fltk__.m --- a/scripts/plot/private/__uiputfile_fltk__.m +++ b/scripts/plot/private/__uiputfile_fltk__.m @@ -25,7 +25,7 @@ function [retval, retpath, retindex] = __uiputfile_fltk__ (filters, title, defval, position, tag, defdir) - if (exist("__fltk_uigetfile__") != 3) + if (exist ("__fltk_uigetfile__") != 3) error ("uiputfile: fltk graphics toolkit required"); endif diff --git a/scripts/plot/quiver.m b/scripts/plot/quiver.m --- a/scripts/plot/quiver.m +++ b/scripts/plot/quiver.m @@ -31,7 +31,7 @@ ## ## If @var{x} and @var{y} are undefined they are assumed to be ## @code{(1:@var{m}, 1:@var{n})} where @code{[@var{m}, @var{n}] = -## size(@var{u})}. +## size (@var{u})}. ## ## The variable @var{s} is a scalar defining a scaling factor to use for ## the arrows of the field relative to the mesh spacing. A value of 0 diff --git a/scripts/plot/quiver3.m b/scripts/plot/quiver3.m --- a/scripts/plot/quiver3.m +++ b/scripts/plot/quiver3.m @@ -31,7 +31,7 @@ ## ## If @var{x}, @var{y} and @var{z} are undefined they are assumed to be ## @code{(1:@var{m}, 1:@var{n}, 1:@var{p})} where @code{[@var{m}, @var{n}] = -## size(@var{u})} and @code{@var{p} = max (size (@var{w}))}. +## size (@var{u})} and @code{@var{p} = max (size (@var{w}))}. ## ## The variable @var{s} is a scalar defining a scaling factor to use for ## the arrows of the field relative to the mesh spacing. A value of 0 diff --git a/scripts/plot/rectangle.m b/scripts/plot/rectangle.m --- a/scripts/plot/rectangle.m +++ b/scripts/plot/rectangle.m @@ -72,7 +72,7 @@ while (iarg < length (varargin)) arg = varargin{iarg}; - if (ischar(arg)) + if (ischar (arg)) if (strcmpi (arg, "position")) pos = varargin{iarg+1}; varargin(iarg:iarg+1) = []; diff --git a/scripts/plot/refreshdata.m b/scripts/plot/refreshdata.m --- a/scripts/plot/refreshdata.m +++ b/scripts/plot/refreshdata.m @@ -82,7 +82,7 @@ for i = 1 : numel (h) obj = get (h (i)); fldnames = fieldnames (obj); - m = regexpi (fieldnames(obj), '^.+datasource$', "match"); + m = regexpi (fieldnames (obj), '^.+datasource$', "match"); idx = ! cellfun ("isempty", m); if (any (idx)) tmp = m(idx); diff --git a/scripts/plot/ribbon.m b/scripts/plot/ribbon.m --- a/scripts/plot/ribbon.m +++ b/scripts/plot/ribbon.m @@ -23,7 +23,7 @@ ## Plot a ribbon plot for the columns of @var{y} vs. @var{x}. The ## optional parameter @var{width} specifies the width of a single ribbon ## (default is 0.75). If @var{x} is omitted, a vector containing the -## row numbers is assumed (1:rows(Y)). +## row numbers is assumed (1:rows (Y)). ## ## The optional return value @var{h} is a vector of graphics handles to ## the surface objects representing each ribbon. diff --git a/scripts/plot/scatter.m b/scripts/plot/scatter.m --- a/scripts/plot/scatter.m +++ b/scripts/plot/scatter.m @@ -50,7 +50,7 @@ ## @group ## x = randn (100, 1); ## y = randn (100, 1); -## scatter (x, y, [], sqrt(x.^2 + y.^2)); +## scatter (x, y, [], sqrt (x.^2 + y.^2)); ## @end group ## @end example ## diff --git a/scripts/plot/semilogy.m b/scripts/plot/semilogy.m --- a/scripts/plot/semilogy.m +++ b/scripts/plot/semilogy.m @@ -47,7 +47,7 @@ newplot (); set (h, "yscale", "log"); - if (any( strcmp (get (gca, "nextplot"), {"new", "replace"}))) + if (any (strcmp (get (gca, "nextplot"), {"new", "replace"}))) set (h, "yminortick", "on"); endif diff --git a/scripts/plot/shading.m b/scripts/plot/shading.m --- a/scripts/plot/shading.m +++ b/scripts/plot/shading.m @@ -55,7 +55,7 @@ obj = [h1(:); h2(:)]; - for n = 1:numel(obj) + for n = 1:numel (obj) h = obj(n); if (strcmpi (mode, "flat")) set (h, "facecolor", "flat"); diff --git a/scripts/plot/slice.m b/scripts/plot/slice.m --- a/scripts/plot/slice.m +++ b/scripts/plot/slice.m @@ -104,7 +104,7 @@ x = varargin{1}; y = varargin{2}; z = varargin{3}; - if (all ([isvector(x), isvector(y), isvector(z)])) + if (isvector (x) && isvector (y) && isvector (z)])) [x, y, z] = meshgrid (x, y, z); elseif (ndims (x) == 3 && size_equal (x, y, z)) ## Do nothing. @@ -120,7 +120,7 @@ if (any ([isvector(sx), isvector(sy), isvector(sz)])) have_sval = true; - elseif (ndims(sx) == 2 && size_equal (sx, sy, sz)) + elseif (ndims (sx) == 2 && size_equal (sx, sy, sz)) have_sval = false; else error ("slice: dimensional mismatch for (XI, YI, ZI) or (SX, SY, SZ)"); @@ -135,10 +135,10 @@ if (have_sval) ns = length (sx) + length (sy) + length (sz); - hs = zeros(ns,1); + hs = zeros (ns,1); [ny, nx, nz] = size (v); - if (length(sz) > 0) - for i = 1:length(sz) + if (length (sz) > 0) + for i = 1:length (sz) [xi, yi, zi] = meshgrid (squeeze (x(1,:,1)), squeeze (y(:,1,1)), sz(i)); vz = squeeze (interp3 (x, y, z, v, xi, yi, zi, method)); @@ -147,7 +147,7 @@ endif if (length (sy) > 0) - for i = length(sy):-1:1 + for i = length (sy):-1:1 [xi, yi, zi] = meshgrid (squeeze (x(1,:,1)), sy(i), squeeze (z(1,1,:))); vy = squeeze (interp3 (x, y, z, v, xi, yi, zi, method)); tmp(sidx++) = surface (squeeze (xi), @@ -157,7 +157,7 @@ endif if (length (sx) > 0) - for i = length(sx):-1:1 + for i = length (sx):-1:1 [xi, yi, zi] = meshgrid (sx(i), squeeze (y(:,1,1)), squeeze (z(1,1,:))); vx = squeeze (interp3 (x, y, z, v, xi, yi, zi, method)); tmp(sidx++) = surface (squeeze (sx(i) * ones (size (zi))), diff --git a/scripts/plot/subplot.m b/scripts/plot/subplot.m --- a/scripts/plot/subplot.m +++ b/scripts/plot/subplot.m @@ -313,7 +313,7 @@ x0 = xi .* (width + margins.column) + margins.left; y0 = yi .* (height + margins.row) + margins.bottom; - if (numel(x0) > 1) + if (numel (x0) > 1) ## subplot (row, col, m:n) x1 = max (x0(:)) + width; y1 = max (y0(:)) + height; @@ -338,14 +338,14 @@ %! xlabel (sprintf ('xlabel #%d', n)); %! ylabel (sprintf ('ylabel #%d', n)); %! title (sprintf ('title #%d', n)); -%! text (0.5, 0.5, sprintf('subplot(%d,%d,%d)', r, c, n), fmt{:}); +%! text (0.5, 0.5, sprintf ('subplot(%d,%d,%d)', r, c, n), fmt{:}); %! axis ([0 1 0 1]); %! end %! subplot (r, c, 1:3); %! xlabel (sprintf ('xlabel #%d:%d', 1, 3)); %! ylabel (sprintf ('ylabel #%d:%d', 1, 3)); %! title (sprintf ('title #%d:%d', 1, 3)); -%! text (0.5, 0.5, sprintf('subplot(%d,%d,%d:%d)', r, c, 1, 3), fmt{:}); +%! text (0.5, 0.5, sprintf ('subplot(%d,%d,%d:%d)', r, c, 1, 3), fmt{:}); %! axis ([0 1 0 1]); %!demo diff --git a/scripts/plot/surface.m b/scripts/plot/surface.m --- a/scripts/plot/surface.m +++ b/scripts/plot/surface.m @@ -145,7 +145,7 @@ elseif (firststring == 1) x = 1:3; y = (x).'; - c = z = eye(3); + c = z = eye (3); else bad_usage = true; endif @@ -175,8 +175,8 @@ %! assert (findobj (hf, "type", "surface"), h); %! assert (get (h, "xdata"), 1:3, eps); %! assert (get (h, "ydata"), (1:3)', eps); -%! assert (get (h, "zdata"), eye(3)); -%! assert (get (h, "cdata"), eye(3)); +%! assert (get (h, "zdata"), eye (3)); +%! assert (get (h, "cdata"), eye (3)); %! assert (get (h, "type"), "surface"); %! assert (get (h, "linestyle"), get (0, "defaultsurfacelinestyle")); %! assert (get (h, "linewidth"), get (0, "defaultsurfacelinewidth"), eps); diff --git a/scripts/plot/surfl.m b/scripts/plot/surfl.m --- a/scripts/plot/surfl.m +++ b/scripts/plot/surfl.m @@ -151,7 +151,7 @@ ## Normalize vn. vn = vn ./ repmat (sqrt (sumsq (vn, 3)), [1, 1, 3]); - [nr, nc] = size(get(htmp, "zdata")); + [nr, nc] = size (get (htmp, "zdata")); ## Ambient, diffuse, and specular term. cdata = (r(1) * ones (nr, nc) diff --git a/scripts/plot/surfnorm.m b/scripts/plot/surfnorm.m --- a/scripts/plot/surfnorm.m +++ b/scripts/plot/surfnorm.m @@ -62,7 +62,7 @@ if (nargin == 1) z = varargin{1}; - [x, y] = meshgrid (1:size(z,1), 1:size(z,2)); + [x, y] = meshgrid (1:rows (z), 1:columns (z)); ioff = 2; else x = varargin{1}; @@ -96,9 +96,9 @@ v.z = zz(1:end-1,2:end) - zz(2:end,1:end-1); c = cross ([u.x(:), u.y(:), u.z(:)], [v.x(:), v.y(:), v.z(:)]); - w.x = reshape (c(:,1), size(u.x)); - w.y = reshape (c(:,2), size(u.y)); - w.z = reshape (c(:,3), size(u.z)); + w.x = reshape (c(:,1), size (u.x)); + w.y = reshape (c(:,2), size (u.y)); + w.z = reshape (c(:,3), size (u.z)); ## Create normal vectors as mesh vectices from normals at mesh centers nx = (w.x(1:end-1,1:end-1) + w.x(1:end-1,2:end) + diff --git a/scripts/plot/text.m b/scripts/plot/text.m --- a/scripts/plot/text.m +++ b/scripts/plot/text.m @@ -134,8 +134,8 @@ %! x = [0.25 0.5 0.75]; %! y = x; %! for t = 0:30:359; -%! for nh = 1:numel(ha) -%! for nv = 1:numel(va) +%! for nh = 1:numel (ha) +%! for nv = 1:numel (va) %! text (x(nh), y(nv), 'Hello World', ... %! 'rotation', t, ... %! 'horizontalalignment', ha{nh}, ... diff --git a/scripts/plot/uigetfile.m b/scripts/plot/uigetfile.m --- a/scripts/plot/uigetfile.m +++ b/scripts/plot/uigetfile.m @@ -81,7 +81,7 @@ error ("uigetfile: number of input arguments must be less than eight"); endif - defaultvals = {cell(0, 2), # File Filter + defaultvals = {cell (0, 2), # File Filter "Open File", # Dialog Title "", # Default file name [240, 120], # Dialog Position (pixel x/y) @@ -165,7 +165,7 @@ prop = varargin{i}; val = varargin{i + 1}; if (strncmp (tolower (prop), "position", 8)) - if (ismatrix (val) && length(val) == 2) + if (ismatrix (val) && length (val) == 2) outargs{4} = val; else error ("uigetfile: expecting 2-element vector for position argument"); diff --git a/scripts/plot/uiputfile.m b/scripts/plot/uiputfile.m --- a/scripts/plot/uiputfile.m +++ b/scripts/plot/uiputfile.m @@ -30,21 +30,21 @@ ## extracted and used as filter. ## In addition the path is selected as current path and the filename is selected ## as default file. -## Example: uiputfile("myfun.m"); +## Example: uiputfile ("myfun.m"); ## ## @item "*.ext" ## A single file extension. -## Example: uiputfile("*.ext"); +## Example: uiputfile ("*.ext"); ## ## @item @{"*.ext","My Description"@} ## A 2-column cell array containing the file extension in the 1st column and ## a brief description in the 2nd column. -## Example: uiputfile(@{"*.ext","My Description";"*.xyz","XYZ-Format"@}); +## Example: uiputfile (@{"*.ext","My Description";"*.xyz","XYZ-Format"@}); ## @end table ## ## The filter string can also contain a semicolon separated list of filter ## extensions. -## Example: uiputfile(@{"*.gif;*.png;*.jpg", "Supported Picture Formats"@}); +## Example: uiputfile (@{"*.gif;*.png;*.jpg", "Supported Picture Formats"@}); ## ## @var{dialog_name} can be used to customize the dialog title. ## If @var{default_file} is given it is preselected in the GUI dialog. @@ -72,14 +72,14 @@ print_usage (); endif - defaultvals = {cell(0, 2), # File Filter + defaultvals = {cell (0, 2), # File Filter "Save File", # Dialog Title "", # Default file name [240, 120], # Dialog Position (pixel x/y) "create", pwd}; # Default directory - outargs = cell(6, 1); + outargs = cell (6, 1); for i = 1 : 6 outargs{i} = defaultvals{i}; endfor diff --git a/scripts/plot/whitebg.m b/scripts/plot/whitebg.m --- a/scripts/plot/whitebg.m +++ b/scripts/plot/whitebg.m @@ -74,7 +74,7 @@ if (isroot) fac = get (0, "factory"); fields = fieldnames (fac); - fieldindex = intersect (find (!cellfun ("isempty", regexp(fields, 'color'))), union (find (!cellfun ("isempty", regexp(fields, 'factoryaxes.*'))), find (!cellfun ("isempty", regexp(fields, 'factoryfigure.*'))))); + fieldindex = intersect (find (!cellfun ("isempty", regexp (fields, 'color'))), union (find (!cellfun ("isempty", regexp (fields, 'factoryaxes.*'))), find (!cellfun ("isempty", regexp (fields, 'factoryfigure.*'))))); ## Check whether the factory value has been replaced for nf = 1 : numel (fieldindex); @@ -95,21 +95,21 @@ while (numel (handles)) children = []; for n = 1 : numel (handles) - children = union (children, get(handles(n), "children")); + children = union (children, get (handles(n), "children")); endfor handles = children; h = union (h, children); endwhile - for nh = 1 : numel(h) + for nh = 1 : numel (h) p = get (h (nh)); fields = fieldnames (p); - fieldindex = find (!cellfun ("isempty", regexp(fields, 'color'))); + fieldindex = find (!cellfun ("isempty", regexp (fields, 'color'))); if (numel (fieldindex)) for nf = 1 : numel (fieldindex); field = fields {fieldindex (nf)}; c = subsref (p, struct ("type", ".", "subs", field)); - if (! ischar(c) && columns(c) == 3) + if (! ischar (c) && columns (c) == 3) set (h (nh), field, 1 - c); endif endfor @@ -121,7 +121,7 @@ def = get (h (nh), "default"); fields = fieldnames (def); if (! isempty (fields)) - fieldindex = find (!cellfun ("isempty", regexp(fields, 'color'))); + fieldindex = find (!cellfun ("isempty", regexp (fields, 'color'))); for nf = 1 : numel (fieldindex) defaultfield = fields {fieldindex (nf)}; defaultvalue = 1 - subsref (def, struct ("type", ".", "subs", defaultfield)); diff --git a/scripts/polynomial/deconv.m b/scripts/polynomial/deconv.m --- a/scripts/polynomial/deconv.m +++ b/scripts/polynomial/deconv.m @@ -40,7 +40,7 @@ endif if (! (isvector (y) && isvector (a))) - error("deconv: both arguments must be vectors"); + error ("deconv: both arguments must be vectors"); endif la = length (a); diff --git a/scripts/polynomial/mkpp.m b/scripts/polynomial/mkpp.m --- a/scripts/polynomial/mkpp.m +++ b/scripts/polynomial/mkpp.m @@ -96,17 +96,17 @@ %!assert (pp.order, 12) %!assert (pp.dim, 1) %!assert (size (pp.coefs), [2,12]) -%! pp = mkpp(b,c,2); +%! pp = mkpp (b,c,2); %!assert (pp.pieces, 2) %!assert (pp.order, 6) %!assert (pp.dim, 2) %!assert (size (pp.coefs), [4,6]) -%! pp = mkpp(b,c,3); +%! pp = mkpp (b,c,3); %!assert (pp.pieces, 2) %!assert (pp.order, 4) %!assert (pp.dim, 3) %!assert (size (pp.coefs), [6,4]) -%! pp = mkpp(b,c,[2,3]); +%! pp = mkpp (b,c,[2,3]); %!assert (pp.pieces, 2) %!assert (pp.order, 2) %!assert (pp.dim, [2,3]) diff --git a/scripts/polynomial/pchip.m b/scripts/polynomial/pchip.m --- a/scripts/polynomial/pchip.m +++ b/scripts/polynomial/pchip.m @@ -144,8 +144,8 @@ %!assert (pchip (x,y,x'), y') %!assert (pchip (x',y',x'), y') %!assert (pchip (x',y',x), y) -%!assert (isempty (pchip(x',y',[]))) -%!assert (isempty (pchip(x,y,[]))) +%!assert (isempty (pchip (x',y',[]))) +%!assert (isempty (pchip (x,y,[]))) %!assert (pchip (x,[y;y],x), [pchip(x,y,x);pchip(x,y,x)]) %!assert (pchip (x,[y;y],x'), [pchip(x,y,x);pchip(x,y,x)]) %!assert (pchip (x',[y;y],x), [pchip(x,y,x);pchip(x,y,x)]) diff --git a/scripts/polynomial/polyaffine.m b/scripts/polynomial/polyaffine.m --- a/scripts/polynomial/polyaffine.m +++ b/scripts/polynomial/polyaffine.m @@ -73,7 +73,7 @@ %! f = [1/5 4/5 -7/5 -2]; %! g = polyaffine (f, [1, 1.2]); %! x = linspace (-4,4,100); -%! plot (x,polyval(f, x), x,polyval(g, x)); +%! plot (x,polyval (f, x), x,polyval (g, x)); %! legend ("original", "affine"); %! axis ([-4 4 -3 5]); %! grid on; diff --git a/scripts/polynomial/polyder.m b/scripts/polynomial/polyder.m --- a/scripts/polynomial/polyder.m +++ b/scripts/polynomial/polyder.m @@ -60,7 +60,7 @@ ## remove common factors from numerator and denominator x = polygcd (q, d); - if (length(x) != 1) + if (length (x) != 1) q = deconv (q, x); d = deconv (d, x); endif diff --git a/scripts/polynomial/polygcd.m b/scripts/polynomial/polygcd.m --- a/scripts/polynomial/polygcd.m +++ b/scripts/polynomial/polygcd.m @@ -23,7 +23,7 @@ ## Find the greatest common divisor of two polynomials. This is equivalent ## to the polynomial found by multiplying together all the common roots. ## Together with deconv, you can reduce a ratio of two polynomials. -## The tolerance @var{tol} defaults to @code{sqrt(eps)}. +## The tolerance @var{tol} defaults to @code{sqrt (eps)}. ## ## @strong{Caution:} This is a numerically unstable algorithm and should not ## be used on large polynomials. @@ -34,7 +34,7 @@ ## @group ## polygcd (poly (1:8), poly (3:12)) - poly (3:8) ## @result{} [ 0, 0, 0, 0, 0, 0, 0 ] -## deconv (poly (1:8), polygcd (poly (1:8), poly (3:12))) - poly(1:2) +## deconv (poly (1:8), polygcd (poly (1:8), poly (3:12))) - poly (1:2) ## @result{} [ 0, 0, 0 ] ## @end group ## @end example diff --git a/scripts/polynomial/polyout.m b/scripts/polynomial/polyout.m --- a/scripts/polynomial/polyout.m +++ b/scripts/polynomial/polyout.m @@ -76,7 +76,7 @@ tmp = " "; endif - if(nargout == 0) + if (nargout == 0) disp (tmp); else y = tmp; diff --git a/scripts/polynomial/polyval.m b/scripts/polynomial/polyval.m --- a/scripts/polynomial/polyval.m +++ b/scripts/polynomial/polyval.m @@ -124,9 +124,9 @@ %! assert (x, polyval (p,x), eps); %! x = x(:); %! assert (x, polyval (p,x), eps); -%! x = reshape(x, [2, 5]); +%! x = reshape (x, [2, 5]); %! assert (x, polyval (p,x), eps); -%! x = reshape(x, [5, 2]); +%! x = reshape (x, [5, 2]); %! assert (x, polyval (p,x), eps); %! x = reshape (x, [1, 1, 5, 2]); %! assert (x, polyval (p,x), eps); diff --git a/scripts/polynomial/ppint.m b/scripts/polynomial/ppint.m --- a/scripts/polynomial/ppint.m +++ b/scripts/polynomial/ppint.m @@ -47,7 +47,7 @@ ppi = mkpp (x, pi, d); tmp = -cumsum (ppjumps (ppi), length (d) + 1); - ppi.coefs(prod(d)+1:end, k) = tmp(:); + ppi.coefs(prod (d)+1 : end, k) = tmp(:); endfunction diff --git a/scripts/polynomial/ppjumps.m b/scripts/polynomial/ppjumps.m --- a/scripts/polynomial/ppjumps.m +++ b/scripts/polynomial/ppjumps.m @@ -34,18 +34,18 @@ endif ## Extract info. - [x, P, n, k, d] = unmkpp(pp); + [x, P, n, k, d] = unmkpp (pp); nd = length (d) + 1; ## Offsets. - dx = diff(x(1:n)); + dx = diff (x(1:n)); dx = repmat (dx, [prod(d), 1]); dx = reshape (dx, [d, n-1]); dx = shiftdim (dx, nd - 1); ## Use Horner scheme. if (k>1) - llim = shiftdim (reshape (P(1:(n-1) * prod(d), 1), [d, n-1]), nd - 1); + llim = shiftdim (reshape (P(1:(n-1) * prod (d), 1), [d, n-1]), nd - 1); endif for i = 2 : k; diff --git a/scripts/polynomial/ppval.m b/scripts/polynomial/ppval.m --- a/scripts/polynomial/ppval.m +++ b/scripts/polynomial/ppval.m @@ -56,7 +56,7 @@ P = reshape (P, [n, k, d]); Pidx = P(idx(:), :);#2d matrix size x: coefs*prod(d) y: prod(sxi) - if (isvector(xi)) + if (isvector (xi)) Pidx = reshape (Pidx, [xn, k, d]); Pidx = shiftdim (Pidx, 1); dimvec = [d, xn]; @@ -92,7 +92,7 @@ if (isvector (xi) && (d == 1)) yi = reshape (yi, sxi); elseif (isfield (pp, "orient") && strcmp (pp.orient, "first")) - yi = shiftdim(yi, nd); + yi = shiftdim (yi, nd); endif ## diff --git a/scripts/polynomial/residue.m b/scripts/polynomial/residue.m --- a/scripts/polynomial/residue.m +++ b/scripts/polynomial/residue.m @@ -252,7 +252,7 @@ A = zeros (border+1, border+1); B = prepad (reshape (b, [numel(b), 1]), border+1, 0); - for ip = 1:numel(p) + for ip = 1:numel (p) ri = zeros (size (p)); ri(ip) = 1; A(:,ip) = prepad (rresidue (ri, p, [], toler), border+1, 0).'; @@ -286,14 +286,14 @@ endif if (numel (e)) - indx = 1:numel(p); + indx = 1:numel (p); else [e, indx] = mpoles (p, toler, 0); p = p (indx); r = r (indx); endif - indx = 1:numel(p); + indx = 1:numel (p); for n = indx pn = [1, -p(n)]; diff --git a/scripts/polynomial/roots.m b/scripts/polynomial/roots.m --- a/scripts/polynomial/roots.m +++ b/scripts/polynomial/roots.m @@ -81,7 +81,7 @@ if (nargin != 1 || min (size (v)) > 1) print_usage (); - elseif (any (isnan(v) | isinf(v))) + elseif (any (isnan (v) | isinf (v))) error ("roots: inputs must not contain Inf or NaN"); endif diff --git a/scripts/polynomial/spline.m b/scripts/polynomial/spline.m --- a/scripts/polynomial/spline.m +++ b/scripts/polynomial/spline.m @@ -108,7 +108,7 @@ endif if (! issorted (x)) - [x, idx] = sort(x); + [x, idx] = sort (x); a = a(idx,:); endif @@ -135,8 +135,8 @@ g(2:n-1,:) = (a(3:n,:) - a(2:n-1,:)) ./ h(2:n-1) - ... (a(2:n-1,:) - a(1:n-2,:)) ./ h(1:n-2); g(n,:) = dfe - (a(n,:) - a(n-1,:)) / h(n-1); - c = spdiags([[h/6;0],[h(1)/3;(h(1:n-2)+h(2:n-1))/3;h(n-1)/3],[0;h/6]],... - [-1,0,1],n,n) \ (g / 2); + c = spdiags ([[h/6;0],[h(1)/3;(h(1:n-2)+h(2:n-1))/3;h(n-1)/3],[0;h/6]],... + [-1,0,1],n,n) \ (g / 2); b(1:n-1,:) = diff (a) ./ h(1:n-1, idx) ... - h(1:n-1,idx) / 3 .* (c(2:n,:) + 2 * c(1:n-1,:)); d = diff (c) ./ (3 * h(1:n-1, idx)); diff --git a/scripts/polynomial/splinefit.m b/scripts/polynomial/splinefit.m --- a/scripts/polynomial/splinefit.m +++ b/scripts/polynomial/splinefit.m @@ -39,7 +39,7 @@ ## ## The optional property @var{periodic} is a logical value which specifies ## whether a periodic boundary condition is applied to the spline. The -## length of the period is @code{max(@var{breaks})-min(@var{breaks})}. +## length of the period is @code{max (@var{breaks}) - min (@var{breaks})}. ## The default value is @code{false}. ## ## The optional property @var{robust} is a logical value which specifies @@ -182,7 +182,7 @@ props = struct (); endif fields = fieldnames (props); - for f = 1:numel(fields) + for f = 1:numel (fields) if (! any (strcmp (fields{f}, {"periodic", "robust", "beta", "order", "constraints"}))) error ("splinefit:invalidproperty", diff --git a/scripts/prefs/addpref.m b/scripts/prefs/addpref.m --- a/scripts/prefs/addpref.m +++ b/scripts/prefs/addpref.m @@ -45,7 +45,7 @@ endif elseif (iscellstr (pref)) if (size_equal (pref, val)) - for i = 1:numel(pref) + for i = 1:numel (pref) if (isfield (group, pref{i})) error ("preference %s already exists in group %s", pref{i}, group); diff --git a/scripts/prefs/getpref.m b/scripts/prefs/getpref.m --- a/scripts/prefs/getpref.m +++ b/scripts/prefs/getpref.m @@ -69,7 +69,7 @@ endif elseif (iscellstr (pref)) if (nargin == 2 || size_equal (pref, default)) - for i = 1:numel(pref) + for i = 1:numel (pref) if (isfield (grp, pref{i})) retval.(pref) = grp.(pref{i}); elseif (nargin == 3) diff --git a/scripts/prefs/setpref.m b/scripts/prefs/setpref.m --- a/scripts/prefs/setpref.m +++ b/scripts/prefs/setpref.m @@ -43,7 +43,7 @@ prefs.(group).(pref) = val; elseif (iscellstr (pref)) if (size_equal (pref, val)) - for i = 1:numel(pref) + for i = 1:numel (pref) prefs.(group).(pref{i}) = val; endfor else diff --git a/scripts/set/ismember.m b/scripts/set/ismember.m --- a/scripts/set/ismember.m +++ b/scripts/set/ismember.m @@ -56,7 +56,7 @@ ## @group ## a = [1:3; 5:7; 4:6]; ## s = [0:2; 1:3; 2:4; 3:5; 4:6]; -## [tf, s_idx] = ismember(a, s, "rows") +## [tf, s_idx] = ismember (a, s, "rows") ## @result{} tf = logical ([1; 0; 1]) ## @result{} s_idx = [2; 0; 5]; ## @end group @@ -185,12 +185,12 @@ %! assert (a_idx, []); %!test -%! [result, a_idx] = ismember([1 2 3 4 5], [3]); +%! [result, a_idx] = ismember ([1 2 3 4 5], [3]); %! assert (result, logical ([0 0 1 0 0])) %! assert (a_idx , [0 0 1 0 0]); %!test -%! [result, a_idx] = ismember([1 6], [1 2 3 4 5 1 6 1]); +%! [result, a_idx] = ismember ([1 6], [1 2 3 4 5 1 6 1]); %! assert (result, [true true]); %! assert (a_idx(2), 7); diff --git a/scripts/set/setxor.m b/scripts/set/setxor.m --- a/scripts/set/setxor.m +++ b/scripts/set/setxor.m @@ -98,5 +98,5 @@ %! a = [3, 1, 4, 1, 5]; b = [1, 2, 3, 4]; %! [y, ia, ib] = setxor (a, b.'); %! assert (y, [2, 5]); -%! assert (y, sort([a(ia), b(ib)])); +%! assert (y, sort ([a(ia), b(ib)])); diff --git a/scripts/signal/arch_fit.m b/scripts/signal/arch_fit.m --- a/scripts/signal/arch_fit.m +++ b/scripts/signal/arch_fit.m @@ -109,7 +109,7 @@ esq = e .^ 2; Z = autoreg_matrix (esq, p); h = Z * a; - f = esq ./ h - ones(T,1); + f = esq ./ h - ones (T,1); Z_tilde = Z ./ (h * ones (1, p+1)); delta_a = inv (Z_tilde' * Z_tilde) * Z_tilde' * f; a = a + gamma * delta_a; diff --git a/scripts/signal/arch_rnd.m b/scripts/signal/arch_rnd.m --- a/scripts/signal/arch_rnd.m +++ b/scripts/signal/arch_rnd.m @@ -71,7 +71,7 @@ b = [b, 0]; lb = lb + 1; endif - m = max([la, lb]); + m = max ([la, lb]); e = zeros (t, 1); h = zeros (t, 1); diff --git a/scripts/signal/arch_test.m b/scripts/signal/arch_test.m --- a/scripts/signal/arch_test.m +++ b/scripts/signal/arch_test.m @@ -80,9 +80,9 @@ if ((rx == 1) && (cx == 1)) x = autoreg_matrix (y, x); elseif (! (rx == T)) - error ("arch_test: either rows(X) == length(Y), or X is a scalar"); + error ("arch_test: either rows (X) == length (Y), or X is a scalar"); endif - if (! (isscalar(p) && (rem(p, 1) == 0) && (p > 0))) + if (! (isscalar (p) && (rem (p, 1) == 0) && (p > 0))) error ("arch_test: P must be a positive integer"); endif diff --git a/scripts/signal/autoreg_matrix.m b/scripts/signal/autoreg_matrix.m --- a/scripts/signal/autoreg_matrix.m +++ b/scripts/signal/autoreg_matrix.m @@ -51,9 +51,9 @@ %!test %! K = 4; -%! A = zeros(1,K+1); +%! A = zeros (1,K+1); %! A(1) = 1; -%! B = eye(K+1); +%! B = eye (K+1); %! B(:,1) = 1; %! assert (autoreg_matrix (A,K), B); diff --git a/scripts/signal/diffpara.m b/scripts/signal/diffpara.m --- a/scripts/signal/diffpara.m +++ b/scripts/signal/diffpara.m @@ -49,7 +49,7 @@ k = 1; x = reshape (x, n, 1); else - [n, k] = size(x); + [n, k] = size (x); endif if (nargin == 1) a = 0.5 * sqrt (n); diff --git a/scripts/signal/fftconv.m b/scripts/signal/fftconv.m --- a/scripts/signal/fftconv.m +++ b/scripts/signal/fftconv.m @@ -67,8 +67,8 @@ %% FIXME: Borrow tests from conv.m. May need a tolerance on the assert comparison %!test -%! x = ones(3,1); -%! y = ones(1,3); +%! x = ones (3,1); +%! y = ones (1,3); %! b = 2; %! c = 3; %! assert (fftconv (x, x), [1; 2; 3; 2; 1], 5*eps); diff --git a/scripts/signal/filter2.m b/scripts/signal/filter2.m --- a/scripts/signal/filter2.m +++ b/scripts/signal/filter2.m @@ -52,7 +52,7 @@ shape = "same"; endif - [nr, nc] = size(b); + [nr, nc] = size (b); y = conv2 (x, b(nr:-1:1, nc:-1:1), shape); endfunction diff --git a/scripts/signal/hanning.m b/scripts/signal/hanning.m --- a/scripts/signal/hanning.m +++ b/scripts/signal/hanning.m @@ -59,5 +59,5 @@ %!error hanning () %!error hanning (0.5) %!error hanning (-1) -%!error hanning (ones(1,4)) +%!error hanning (ones (1,4)) diff --git a/scripts/signal/hurst.m b/scripts/signal/hurst.m --- a/scripts/signal/hurst.m +++ b/scripts/signal/hurst.m @@ -42,7 +42,7 @@ s = std (x); w = cumsum (x - mean (x)); - RS = (max(w) - min(w)) ./ s; + RS = (max (w) - min (w)) ./ s; H = log (RS) / log (xr); endfunction diff --git a/scripts/signal/periodogram.m b/scripts/signal/periodogram.m --- a/scripts/signal/periodogram.m +++ b/scripts/signal/periodogram.m @@ -40,7 +40,7 @@ ## @item win: weight data with window, x.*win is used for further computation, ## if window is empty, a rectangular window is used. ## -## @item nfft: number of frequency bins, default max(256, 2.^ceil(log2(length(x)))). +## @item nfft: number of frequency bins, default max (256, 2.^ceil (log2 (length (x)))). ## ## @item Fs: sampling rate, default 1. ## diff --git a/scripts/signal/private/triangle_sw.m b/scripts/signal/private/triangle_sw.m --- a/scripts/signal/private/triangle_sw.m +++ b/scripts/signal/private/triangle_sw.m @@ -31,7 +31,7 @@ print_usage (); endif - retval = zeros(n,1); + retval = zeros (n,1); retval(1) = 1 / b; l = (2:n)' - 1; diff --git a/scripts/signal/sinc.m b/scripts/signal/sinc.m --- a/scripts/signal/sinc.m +++ b/scripts/signal/sinc.m @@ -23,7 +23,7 @@ ## $ \sin (\pi x)/(\pi x)$. ## @end tex ## @ifnottex -## sin(pi*x)/(pi*x). +## sin (pi*x) / (pi*x). ## @end ifnottex ## @end deftypefn diff --git a/scripts/signal/spectral_xdf.m b/scripts/signal/spectral_xdf.m --- a/scripts/signal/spectral_xdf.m +++ b/scripts/signal/spectral_xdf.m @@ -53,7 +53,7 @@ x = x - sum (x) / xr; retval = (abs (fft (x)) / xr).^2; - retval = real (ifft (fft(retval) .* fft(w))); + retval = real (ifft (fft (retval) .* fft (w))); retval = [(zeros (xr, 1)), retval]; retval(:, 1) = (0 : xr-1)' / xr; diff --git a/scripts/signal/spencer.m b/scripts/signal/spencer.m --- a/scripts/signal/spencer.m +++ b/scripts/signal/spencer.m @@ -31,15 +31,15 @@ print_usage (); endif - [xr, xc] = size(x); + [xr, xc] = size (x); n = xr; c = xc; - if (isvector(x)) - n = length(x); + if (isvector (x)) + n = length (x); c = 1; - x = reshape(x, n, 1); + x = reshape (x, n, 1); endif w = [-3, -6, -5, 3, 21, 46, 67, 74, 67, 46, 21, 3, -5, -6, -3] / 320; @@ -47,7 +47,7 @@ retval = fftfilt (w, x); retval = [zeros(7,c); retval(15:n,:); zeros(7,c);]; - retval = reshape(retval, xr, xc); + retval = reshape (retval, xr, xc); endfunction diff --git a/scripts/signal/stft.m b/scripts/signal/stft.m --- a/scripts/signal/stft.m +++ b/scripts/signal/stft.m @@ -55,7 +55,7 @@ ## Author: AW ## Description: Short-Time Fourier Transform -function [y, c] = stft(x, win_size, inc, num_coef, win_type) +function [y, c] = stft (x, win_size, inc, num_coef, win_type) ## Default values of unspecified arguments. if (nargin < 5) diff --git a/scripts/signal/synthesis.m b/scripts/signal/synthesis.m --- a/scripts/signal/synthesis.m +++ b/scripts/signal/synthesis.m @@ -62,11 +62,11 @@ z = z(st:st+inc-1, :); w_coeff = w_coeff(st:st+inc-1); - nc = columns(z); + nc = columns (z); for i = 1:nc z(:, i) = z(:, i) ./ w_coeff; endfor - x = reshape(z, inc * nc, 1); + x = reshape (z, inc * nc, 1); endfunction diff --git a/scripts/signal/unwrap.m b/scripts/signal/unwrap.m --- a/scripts/signal/unwrap.m +++ b/scripts/signal/unwrap.m @@ -36,7 +36,7 @@ print_usage (); endif - if (!isnumeric(x)) + if (!isnumeric (x)) error ("unwrap: X must be a numeric matrix or vector"); endif @@ -78,7 +78,7 @@ ## Find only the peaks, and multiply them by the appropriate amount ## of ranges so that there are kronecker deltas at each wrap point ## multiplied by the appropriate amount of range values. - p = ceil(abs(d)./rng) .* rng .* (((d > tol) > 0) - ((d < -tol) > 0)); + p = ceil (abs (d)./rng) .* rng .* (((d > tol) > 0) - ((d < -tol) > 0)); ## Now need to "integrate" this so that the deltas become steps. r = cumsum (p, dim); @@ -90,7 +90,7 @@ endfunction -%!function t = __xassert(a,b,tol) +%!function t = __xassert (a,b,tol) %! if (nargin == 1) %! t = all (a(:)); %! else diff --git a/scripts/signal/yulewalker.m b/scripts/signal/yulewalker.m --- a/scripts/signal/yulewalker.m +++ b/scripts/signal/yulewalker.m @@ -41,7 +41,7 @@ endif cp = c(2 : p+1); - CP = zeros(p, p); + CP = zeros (p, p); for i = 1:p for j = 1:p diff --git a/scripts/sparse/bicgstab.m b/scripts/sparse/bicgstab.m --- a/scripts/sparse/bicgstab.m +++ b/scripts/sparse/bicgstab.m @@ -138,7 +138,7 @@ rr = res; ## Vector of the residual norms for each iteration. - resvec = norm(res) / norm_b; + resvec = norm (res) / norm_b; ## Default behaviour we don't reach tolerance tol within maxit iterations. flag = 1; diff --git a/scripts/sparse/gmres.m b/scripts/sparse/gmres.m --- a/scripts/sparse/gmres.m +++ b/scripts/sparse/gmres.m @@ -224,7 +224,7 @@ %! x = gmres (@(x) A*x, b, dim, 1e-10, 1e6, @(x) diag (diag (A)) \ x, [], []); %! assert (x, A\b, 1e-9*norm (x, Inf)); %!test -%! x = gmres (@(x) A*x, b, dim, 1e-10, 1e6, @(x) x./diag(A), [], []); +%! x = gmres (@(x) A*x, b, dim, 1e-10, 1e6, @(x) x ./ diag (A), [], []); %! assert (x, A\b, 1e-7*norm (x, Inf)); diff --git a/scripts/sparse/pcg.m b/scripts/sparse/pcg.m --- a/scripts/sparse/pcg.m +++ b/scripts/sparse/pcg.m @@ -275,7 +275,7 @@ while (resvec (iter-1,1) > tol * resvec (1,1) && iter < maxit) if (exist_m1) - if(isnumeric (m1)) + if (isnumeric (m1)) y = m1 \ r; else y = feval (m1, r, varargin{:}); @@ -316,8 +316,8 @@ if (nargout > 5 && iter > 2) T(iter-1:iter, iter-1:iter) = T(iter-1:iter, iter-1:iter) + ... [1 sqrt(beta); sqrt(beta) beta]./oldalpha; - ## EVS = eig(T(2:iter-1,2:iter-1)); - ## fprintf(stderr,"PCG condest: %g (iteration: %d)\n", max(EVS)/min(EVS),iter); + ## EVS = eig (T(2:iter-1,2:iter-1)); + ## fprintf (stderr,"PCG condest: %g (iteration: %d)\n", max (EVS)/min (EVS),iter); endif resvec (iter,1) = norm (r); iter++; diff --git a/scripts/sparse/pcr.m b/scripts/sparse/pcr.m --- a/scripts/sparse/pcr.m +++ b/scripts/sparse/pcr.m @@ -252,7 +252,7 @@ x += lambda*p; r -= lambda*q; - if (isnumeric(A)) # is A a matrix? + if (isnumeric (A)) # is A a matrix? t = A*s; else # then A should be a function! t = feval (A, s, varargin{:}); diff --git a/scripts/sparse/private/__sprand_impl__.m b/scripts/sparse/private/__sprand_impl__.m --- a/scripts/sparse/private/__sprand_impl__.m +++ b/scripts/sparse/private/__sprand_impl__.m @@ -39,7 +39,7 @@ return; endif - [m, n, d, funname, randfun] = deal(varargin{:}); + [m, n, d, funname, randfun] = deal (varargin{:}); if (!(isscalar (m) && m == fix (m) && m > 0)) error ("%s: M must be an integer greater than 0", funname); @@ -60,4 +60,4 @@ [i, j] = ind2sub ([m, n], idx); S = sparse (i, j, randfun (k, 1), m, n); -endfunction \ No newline at end of file +endfunction diff --git a/scripts/sparse/speye.m b/scripts/sparse/speye.m --- a/scripts/sparse/speye.m +++ b/scripts/sparse/speye.m @@ -32,7 +32,7 @@ function s = speye (m, n) if (nargin == 1) - if (isvector (m) && length(m) == 2) + if (isvector (m) && length (m) == 2) n = m(2); m = m(1); elseif (isscalar (m)) diff --git a/scripts/sparse/spfun.m b/scripts/sparse/spfun.m --- a/scripts/sparse/spfun.m +++ b/scripts/sparse/spfun.m @@ -37,7 +37,7 @@ if (isa (f, "function_handle") || isa (f, "inline function")) y = sparse (i, j, f(v), m, n); else - y = sparse(i, j, feval (f, v), m, n); + y = sparse (i, j, feval (f, v), m, n); endif endfunction diff --git a/scripts/sparse/sprandn.m b/scripts/sparse/sprandn.m --- a/scripts/sparse/sprandn.m +++ b/scripts/sparse/sprandn.m @@ -63,10 +63,10 @@ %!error sprandn () %!error sprandn (1, 2) %!error sprandn (1, 2, 3, 4) -%!error sprandn (ones(3), 3, 0.5) +%!error sprandn (ones (3), 3, 0.5) %!error sprandn (3.5, 3, 0.5) %!error sprandn (0, 3, 0.5) -%!error sprandn (3, ones(3), 0.5) +%!error sprandn (3, ones (3), 0.5) %!error sprandn (3, 3.5, 0.5) %!error sprandn (3, 0, 0.5) %!error sprandn (3, 3, -1) diff --git a/scripts/sparse/spstats.m b/scripts/sparse/spstats.m --- a/scripts/sparse/spstats.m +++ b/scripts/sparse/spstats.m @@ -51,7 +51,7 @@ endif if (nargout > 2) ## FIXME Variance with count = 0 or 1? - diff = S - sparse (i, j, mean(j), n, m); + diff = S - sparse (i, j, mean (j), n, m); var = sum (diff .* diff) ./ (count - 1); endif diff --git a/scripts/sparse/svds.m b/scripts/sparse/svds.m --- a/scripts/sparse/svds.m +++ b/scripts/sparse/svds.m @@ -85,7 +85,7 @@ ## @end example ## ## @code{svds} is best for finding only a few singular values from a large -## sparse matrix. Otherwise, @code{svd (full(@var{A}))} will likely be more +## sparse matrix. Otherwise, @code{svd (full (@var{A}))} will likely be more ## efficient. ## @end deftypefn ## @seealso{svd, eigs} @@ -98,7 +98,7 @@ print_usage (); endif - if (ndims(A) > 2) + if (ndims (A) > 2) error ("svds: A must be a 2D matrix"); endif @@ -194,7 +194,7 @@ ## norm since if we don't we might end up with too many singular ## values. tol = norma * opts.tol; - ind = find(s > tol); + ind = find (s > tol); if (length (ind) < k) ## Too few eigenvalues returned. Add in any zero eigenvalues of B, ## including the nominally negative ones. @@ -248,7 +248,7 @@ %! A = sparse ([3:n,1:n,1:(n-2)],[1:(n-2),1:n,3:n],[ones(1,n-2),0.4*n*ones(1,n),ones(1,n-2)]); %! [u,s,v] = svd (full (A)); %! s = diag (s); -%! [~, idx] = sort (abs(s)); +%! [~, idx] = sort (abs (s)); %! s = s(idx); %! u = u(:, idx); %! v = v(:, idx); @@ -272,7 +272,7 @@ %! assert (s2, s(k:-1:1), 1e-10); %! %!testif HAVE_ARPACK, HAVE_UMFPACK -%! idx = floor(n/2); +%! idx = floor (n/2); %! % Don't put sigma right on a singular value or there are convergence issues %! sigma = 0.99*s(idx) + 0.01*s(idx+1); %! [u2,s2,v2,flag] = svds (A,k,sigma,opts); diff --git a/scripts/sparse/treelayout.m b/scripts/sparse/treelayout.m --- a/scripts/sparse/treelayout.m +++ b/scripts/sparse/treelayout.m @@ -141,7 +141,7 @@ ## We are in top level separator when we have one child and the ## flag is 1 - if (columns(idx) == 1 && top_level == 1) + if (columns (idx) == 1 && top_level == 1) s++; else # We aren't in top level separator now. @@ -152,7 +152,7 @@ left_most++; x_coordinate_r(par_number) = left_most; max_ht = min (max_ht, level); - if (length(stk) > 1 && find ((shift(stk,1)-stk) == 0) > 1 + if (length (stk) > 1 && find ((shift (stk,1) - stk) == 0) > 1 && stk(end,2) != stk(end-1,2)) ## Return to the nearest branching the position to return ## position is the position on the stack, where should be diff --git a/scripts/sparse/treeplot.m b/scripts/sparse/treeplot.m --- a/scripts/sparse/treeplot.m +++ b/scripts/sparse/treeplot.m @@ -116,13 +116,13 @@ left_most++; x_coordinate_r(par_number) = left_most; max_ht = min (max_ht, level); - if (length(stk) > 1 && find ((shift(stk,1)-stk) == 0) > 1 + if (length (stk) > 1 && find ((shift (stk,1) - stk) == 0) > 1 && stk(end,2) != stk(end-1,2)) ## Return to the nearest branching the position to return ## position is the position on the stack, where should be ## started further search (there are two nodes which has the ## same parent node). - position = (find ((shift(stk(:,2),1)-stk(:,2)) == 0))(end) + 1; + position = (find ((shift (stk(:,2),1) - stk(:,2)) == 0))(end) + 1; par_number_vec = stk(position:end,2); ## The vector of removed nodes (the content of stack form ## position to end). @@ -173,7 +173,7 @@ hold ("on"); ## Plot each tree component in one loop. - for i = 2:length(idx) + for i = 2:length (idx) ## Tree component start. istart = idx(i-1) + 1; ## Tree component end. diff --git a/scripts/specfun/bessel.m b/scripts/specfun/bessel.m --- a/scripts/specfun/bessel.m +++ b/scripts/specfun/bessel.m @@ -27,21 +27,21 @@ ## @table @code ## @item besselj ## Bessel functions of the first kind. If the argument @var{opt} is supplied, -## the result is multiplied by @code{exp(-abs(imag(x)))}. +## the result is multiplied by @code{exp (-abs (imag (x)))}. ## ## @item bessely ## Bessel functions of the second kind. If the argument @var{opt} is supplied, -## the result is multiplied by @code{exp(-abs(imag(x)))}. +## the result is multiplied by @code{exp (-abs (imag (x)))}. ## ## @item besseli ## Modified Bessel functions of the first kind. If the argument @var{opt} is ## supplied, -## the result is multiplied by @code{exp(-abs(real(x)))}. +## the result is multiplied by @code{exp (-abs (real (x)))}. ## ## @item besselk ## Modified Bessel functions of the second kind. If the argument @var{opt} is ## supplied, -## the result is multiplied by @code{exp(x)}. +## the result is multiplied by @code{exp (x)}. ## ## @item besselh ## Compute Hankel functions of the first (@var{k} = 1) or second (@var{k} diff --git a/scripts/specfun/factor.m b/scripts/specfun/factor.m --- a/scripts/specfun/factor.m +++ b/scripts/specfun/factor.m @@ -76,7 +76,7 @@ ## Determine muliplicity. if (nargout > 1) idx = find ([0, x] != [x, 0]); - x = x(idx(1:length(idx)-1)); + x = x(idx(1:length (idx)-1)); n = diff (idx); endif diff --git a/scripts/specfun/legendre.m b/scripts/specfun/legendre.m --- a/scripts/specfun/legendre.m +++ b/scripts/specfun/legendre.m @@ -196,7 +196,7 @@ ## http://en.wikipedia.org/wiki/Associated_Legendre_function overflow = false; - retval = zeros([n+1, size(x)]); + retval = zeros ([n+1, size(x)]); for m = 1:n lpm1 = scale; lpm2 = (2*m-1) .* x .* scale; @@ -222,7 +222,7 @@ ## normalization == "sch" or normalization == "norm" scale = scale / sqrt ((n-m+1)*(n+m))*(2*m-1); endif - scale = scale .* sqrt(1-x.^2); + scale = scale .* sqrt (1-x.^2); endfor retval(n+1,:) = scale(:); diff --git a/scripts/specfun/perms.m b/scripts/specfun/perms.m --- a/scripts/specfun/perms.m +++ b/scripts/specfun/perms.m @@ -24,7 +24,7 @@ ## result has size @code{factorial (@var{n}) * @var{n}}, where @var{n} ## is the length of @var{v}. ## -## As an example, @code{perms([1, 2, 3])} returns the matrix +## As an example, @code{perms ([1, 2, 3])} returns the matrix ## ## @example ## @group diff --git a/scripts/specfun/primes.m b/scripts/specfun/primes.m --- a/scripts/specfun/primes.m +++ b/scripts/specfun/primes.m @@ -31,7 +31,7 @@ ## $k \log (5 k)$. ## @end tex ## @ifnottex -## k*log(5*k). +## k*log (5*k). ## @end ifnottex ## @seealso{list_primes, isprime} ## @end deftypefn @@ -61,7 +61,7 @@ sievem = true (1, lenm); # assume every number of form 6n-1 is prime sievep = true (1, lenp); # assume every number of form 6n+1 is prime - for i = 1:(sqrt(n)+1)/6 # check up to sqrt(n) + for i = 1:(sqrt (n)+1)/6 # check up to sqrt (n) if (sievem(i)) # if i is prime, eliminate multiples of i sievem(7*i-1:6*i-1:lenm) = false; sievep(5*i-1:6*i-1:lenp) = false; @@ -71,11 +71,11 @@ sievem(5*i+1:6*i+1:lenm) = false; endif endfor - x = sort([2, 3, 6*find(sievem)-1, 6*find(sievep)+1]); + x = sort ([2, 3, 6*find(sievem)-1, 6*find(sievep)+1]); elseif (n > 352) # nothing magical about 352; must be >2 len = floor ((n-1)/2); # length of the sieve sieve = true (1, len); # assume every odd number is prime - for i = 1:(sqrt(n)-1)/2 # check up to sqrt(n) + for i = 1:(sqrt (n)-1)/2 # check up to sqrt (n) if (sieve(i)) # if i is prime, eliminate multiples of i sieve(3*i+1:2*i+1:len) = false; # do it endif diff --git a/scripts/special-matrix/magic.m b/scripts/special-matrix/magic.m --- a/scripts/special-matrix/magic.m +++ b/scripts/special-matrix/magic.m @@ -26,7 +26,7 @@ ## Note: @var{n} must be greater than 2 for the magic square to exist. ## @end deftypefn -function A = magic(n) +function A = magic (n) if (nargin != 1) print_usage (); diff --git a/scripts/special-matrix/toeplitz.m b/scripts/special-matrix/toeplitz.m --- a/scripts/special-matrix/toeplitz.m +++ b/scripts/special-matrix/toeplitz.m @@ -105,8 +105,8 @@ ridx = ridx(ridx > 1); ## Form matrix. - retval = spdiags(repmat (c(cidx),nr,1),1-cidx,nr,nc) + ... - spdiags(repmat (r(ridx),nr,1),ridx-1,nr,nc); + retval = spdiags (repmat (c(cidx),nr,1),1-cidx,nr,nc) + ... + spdiags (repmat (r(ridx),nr,1),ridx-1,nr,nc); else ## Concatenate data into a single column vector. data = [r(end:-1:2)(:); c(:)]; diff --git a/scripts/statistics/base/corr.m b/scripts/statistics/base/corr.m --- a/scripts/statistics/base/corr.m +++ b/scripts/statistics/base/corr.m @@ -101,7 +101,7 @@ %! assert (corr ([x, y]), single ([1 -1; -1 1]), 5*eps); %!assert (corr (5), 1) -%!assert (corr (single(5)), single(1)) +%!assert (corr (single (5)), single (1)) %% Test input validation %!error corr () diff --git a/scripts/statistics/base/cov.m b/scripts/statistics/base/cov.m --- a/scripts/statistics/base/cov.m +++ b/scripts/statistics/base/cov.m @@ -144,15 +144,15 @@ %! assert (isscalar (c)); %! assert (c, 2.5); -%!assert(cov (5), 0) -%!assert(cov (single(5)), single(0)) +%!assert (cov (5), 0) +%!assert (cov (single (5)), single (0)) %!test %! x = [1:5]; %! c = cov (x, 0); -%! assert(c, 2.5); +%! assert (c, 2.5); %! c = cov (x, 1); -%! assert(c, 2); +%! assert (c, 2); %% Test input validation %!error cov () diff --git a/scripts/statistics/base/mean.m b/scripts/statistics/base/mean.m --- a/scripts/statistics/base/mean.m +++ b/scripts/statistics/base/mean.m @@ -143,7 +143,7 @@ %!error mean (1, 2, 3, 4) %!error mean ({1:5}) %!error mean (1, 2, 3) -%!error mean (1, ones(2,2)) +%!error mean (1, ones (2,2)) %!error mean (1, 1.5) %!error mean (1, 0) %!error mean (1, 3) diff --git a/scripts/statistics/base/median.m b/scripts/statistics/base/median.m --- a/scripts/statistics/base/median.m +++ b/scripts/statistics/base/median.m @@ -117,7 +117,7 @@ %!error median (1, 2, 3) %!error median ({1:5}) %!error median (['A'; 'B']) -%!error median (1, ones(2,2)) +%!error median (1, ones (2,2)) %!error median (1, 1.5) %!error median (1, 0) diff --git a/scripts/statistics/base/mode.m b/scripts/statistics/base/mode.m --- a/scripts/statistics/base/mode.m +++ b/scripts/statistics/base/mode.m @@ -112,7 +112,7 @@ %! [m2, f2, c2] = mode (full (a)); %! assert (m, sparse (m2)); %! assert (f, sparse (f2)); -%! c_exp(1:length(a)) = { sparse (0) }; +%! c_exp(1:length (a)) = { sparse (0) }; %! assert (c ,c_exp); %! assert (c2,c_exp ); diff --git a/scripts/statistics/base/qqplot.m b/scripts/statistics/base/qqplot.m --- a/scripts/statistics/base/qqplot.m +++ b/scripts/statistics/base/qqplot.m @@ -58,7 +58,7 @@ print_usage (); endif - if (!(isnumeric (x) && isvector(x))) + if (!(isnumeric (x) && isvector (x))) error ("qqplot: X must be a numeric vector"); endif diff --git a/scripts/statistics/base/quantile.m b/scripts/statistics/base/quantile.m --- a/scripts/statistics/base/quantile.m +++ b/scripts/statistics/base/quantile.m @@ -131,7 +131,7 @@ endif ## Set the permutation vector. - perm = 1:ndims(x); + perm = 1:ndims (x); perm(1) = dim; perm(dim) = 1; diff --git a/scripts/statistics/base/ranks.m b/scripts/statistics/base/ranks.m --- a/scripts/statistics/base/ranks.m +++ b/scripts/statistics/base/ranks.m @@ -54,7 +54,7 @@ endif if (sz(dim) == 1) - y = ones(sz); + y = ones (sz); else ## The algorithm works only on dim = 1, so permute if necesary. if (dim != 1) @@ -73,7 +73,7 @@ runs = setdiff (eq_el, eq_el+1); len = diff (find (diff ([Inf; eq_el; -Inf]) != 1)) + 1; [eq_el, y] = sort (xi); - for i = 1 : length(runs) + for i = 1 : length (runs) y (xi (runs (i) + [0:(len(i)-1)]) + floor (runs (i) ./ sz(1)) * sz(1)) = eq_el(runs(i)) + (len(i) - 1) / 2; endfor diff --git a/scripts/statistics/base/zscore.m b/scripts/statistics/base/zscore.m --- a/scripts/statistics/base/zscore.m +++ b/scripts/statistics/base/zscore.m @@ -52,8 +52,8 @@ if (nargin < 2) opt = 0; else - if (opt != 0 && opt != 1 || ! isscalar(opt)) - error("zscore: OPT must be empty, 0, or 1"); + if (opt != 0 && opt != 1 || ! isscalar (opt)) + error ("zscore: OPT must be empty, 0, or 1"); endif endif diff --git a/scripts/statistics/models/private/logistic_regression_likelihood.m b/scripts/statistics/models/private/logistic_regression_likelihood.m --- a/scripts/statistics/models/private/logistic_regression_likelihood.m +++ b/scripts/statistics/models/private/logistic_regression_likelihood.m @@ -35,7 +35,7 @@ e = exp ([z, x] * beta); e1 = exp ([z1, x] * beta); g = e ./ (1 + e); g1 = e1 ./ (1 + e1); - g = max (y == max (y), g); g1 = min (y > min(y), g1); + g = max (y == max (y), g); g1 = min (y > min (y), g1); p = g - g1; dev = -2 * sum (log (p)); diff --git a/scripts/statistics/tests/bartlett_test.m b/scripts/statistics/tests/bartlett_test.m --- a/scripts/statistics/tests/bartlett_test.m +++ b/scripts/statistics/tests/bartlett_test.m @@ -61,7 +61,7 @@ pval = 1 - chi2cdf (chisq, df); if (nargout == 0) - printf(" pval: %g\n", pval); + printf (" pval: %g\n", pval); endif endfunction diff --git a/scripts/statistics/tests/chisquare_test_homogeneity.m b/scripts/statistics/tests/chisquare_test_homogeneity.m --- a/scripts/statistics/tests/chisquare_test_homogeneity.m +++ b/scripts/statistics/tests/chisquare_test_homogeneity.m @@ -42,7 +42,7 @@ print_usage (); endif - if (! (isvector(x) && isvector(y) && isvector(c))) + if (! (isvector (x) && isvector (y) && isvector (c))) error ("chisquare_test_homogeneity: X, Y and C must be vectors"); endif ## Now test c for strictly increasing entries @@ -57,12 +57,12 @@ n_x = sum (x * ones (1, df+1) < ones (l_x, 1) * c); l_y = length (y); y = reshape (y, l_y, 1); - n_y = sum(y * ones (1, df+1) < ones (l_y, 1) * c); + n_y = sum (y * ones (1, df+1) < ones (l_y, 1) * c); chisq = l_x * l_y * sum ((n_x/l_x - n_y/l_y).^2 ./ (n_x + n_y)); pval = 1 - chi2cdf (chisq, df); if (nargout == 0) - printf(" pval: %g\n", pval); + printf (" pval: %g\n", pval); endif endfunction diff --git a/scripts/statistics/tests/chisquare_test_independence.m b/scripts/statistics/tests/chisquare_test_independence.m --- a/scripts/statistics/tests/chisquare_test_independence.m +++ b/scripts/statistics/tests/chisquare_test_independence.m @@ -47,7 +47,7 @@ pval = 1 - chi2cdf (chisq, df); if (nargout == 0) - printf(" pval: %g\n", pval); + printf (" pval: %g\n", pval); endif endfunction diff --git a/scripts/statistics/tests/kolmogorov_smirnov_test.m b/scripts/statistics/tests/kolmogorov_smirnov_test.m --- a/scripts/statistics/tests/kolmogorov_smirnov_test.m +++ b/scripts/statistics/tests/kolmogorov_smirnov_test.m @@ -28,7 +28,7 @@ ## a uniform distribution on [2,4], use ## ## @example -## kolmogorov_smirnov_test(x, "unif", 2, 4) +## kolmogorov_smirnov_test (x, "unif", 2, 4) ## @end example ## ## @noindent diff --git a/scripts/statistics/tests/run_test.m b/scripts/statistics/tests/run_test.m --- a/scripts/statistics/tests/run_test.m +++ b/scripts/statistics/tests/run_test.m @@ -46,13 +46,13 @@ b = [1/6; 5/24; 11/120; 19/720; 29/5040; 1/840]; n = rows (x); - r = run_count (x, 6) - n * b * ones (1, columns(x)); + r = run_count (x, 6) - n * b * ones (1, columns (x)); chisq = diag (r' * A * r)' / n; pval = chi2cdf (chisq, 6); if (nargout == 0) - printf("pval: %g\n", pval); + printf ("pval: %g\n", pval); endif endfunction diff --git a/scripts/statistics/tests/u_test.m b/scripts/statistics/tests/u_test.m --- a/scripts/statistics/tests/u_test.m +++ b/scripts/statistics/tests/u_test.m @@ -66,7 +66,7 @@ endif if (! ischar (alt)) - error("u_test: ALT must be a string"); + error ("u_test: ALT must be a string"); endif if (strcmp (alt, "!=") || strcmp (alt, "<>")) pval = 2 * min (cdf, 1 - cdf); diff --git a/scripts/statistics/tests/wilcoxon_test.m b/scripts/statistics/tests/wilcoxon_test.m --- a/scripts/statistics/tests/wilcoxon_test.m +++ b/scripts/statistics/tests/wilcoxon_test.m @@ -73,7 +73,7 @@ endif if (! ischar (alt)) - error("wilcoxon_test: ALT must be a string"); + error ("wilcoxon_test: ALT must be a string"); elseif (strcmp (alt, "!=") || strcmp (alt, "<>")) pval = 2 * min (cdf, 1 - cdf); elseif (strcmp (alt, ">")) diff --git a/scripts/statistics/tests/z_test.m b/scripts/statistics/tests/z_test.m --- a/scripts/statistics/tests/z_test.m +++ b/scripts/statistics/tests/z_test.m @@ -79,8 +79,8 @@ if (nargout == 0) s = cstrcat ("Z-test of mean(x) == %g against mean(x) %s %g,\n", - "with known var(x) == %g:\n", - " pval = %g\n"); + "with known var(x) == %g:\n", + " pval = %g\n"); printf (s, m, alt, m, v, pval); endif diff --git a/scripts/statistics/tests/z_test_2.m b/scripts/statistics/tests/z_test_2.m --- a/scripts/statistics/tests/z_test_2.m +++ b/scripts/statistics/tests/z_test_2.m @@ -48,7 +48,7 @@ endif if (! (isvector (x) && isvector (y))) - error("z_test_2: both X and Y must be vectors"); + error ("z_test_2: both X and Y must be vectors"); elseif (! (isscalar (v_x) && (v_x > 0) && isscalar (v_y) && (v_y > 0))) error ("z_test_2: both V_X and V_Y must be positive scalars"); @@ -79,9 +79,9 @@ if (nargout == 0) s = cstrcat ("Two-sample Z-test of mean(x) == mean(y) against ", - "mean(x) %s mean(y),\n", - "with known var(x) == %g and var(y) == %g:\n", - " pval = %g\n"); + "mean(x) %s mean(y),\n", + "with known var(x) == %g and var(y) == %g:\n", + " pval = %g\n"); printf (s, alt, v_x, v_y, pval); endif diff --git a/scripts/strings/bin2dec.m b/scripts/strings/bin2dec.m --- a/scripts/strings/bin2dec.m +++ b/scripts/strings/bin2dec.m @@ -60,10 +60,10 @@ endfunction -%!assert(bin2dec ("0000"), 0) -%!assert(bin2dec ("1110"), 14) -%!assert(bin2dec ("11111111111111111111111111111111111111111111111111111"), 2^53-1) -%!assert(bin2dec ({"1110", "1111"}), [14; 15]) +%!assert (bin2dec ("0000"), 0) +%!assert (bin2dec ("1110"), 14) +%!assert (bin2dec ("11111111111111111111111111111111111111111111111111111"), 2^53-1) +%!assert (bin2dec ({"1110", "1111"}), [14; 15]) %!assert (bin2dec ("1 0 1"), 5) %!assert (bin2dec (char ("1 0 1", " 1111")), [5; 15]) diff --git a/scripts/strings/dec2base.m b/scripts/strings/dec2base.m --- a/scripts/strings/dec2base.m +++ b/scripts/strings/dec2base.m @@ -161,7 +161,7 @@ %!error dec2base (1.1) %!error dec2base (1, "ABA") %!error dec2base (1, "A B") -%!error dec2base (1, ones(2)) +%!error dec2base (1, ones (2)) %!error dec2base (1, 1) %!error dec2base (1, 37) diff --git a/scripts/strings/mat2str.m b/scripts/strings/mat2str.m --- a/scripts/strings/mat2str.m +++ b/scripts/strings/mat2str.m @@ -41,7 +41,7 @@ ## mat2str ([ -1/3 +i/7; 1/3 -i/7 ], [4 2]) ## @result{} "[-0.3333+0i 0+0.14i;0.3333+0i -0-0.14i]" ## -## mat2str (int16([1 -1]), "class") +## mat2str (int16 ([1 -1]), "class") ## @result{} "int16([1 -1])" ## ## mat2str (logical (eye (2))) @@ -143,5 +143,5 @@ %!error mat2str () %!error mat2str (1,2,3,4) %!error mat2str (["Hello"]) -%!error mat2str (ones(3,3,2)) +%!error mat2str (ones (3,3,2)) diff --git a/scripts/strings/strcat.m b/scripts/strings/strcat.m --- a/scripts/strings/strcat.m +++ b/scripts/strings/strcat.m @@ -143,8 +143,8 @@ %!assert (all (strcmp (strcat ({"a", "bb"}, "ccc"), {"accc", "bbccc"}))) %!assert (all (strcmp (strcat ("a", {"bb", "ccc"}), {"abb", "accc"}))) -%!assert (strcat (1, 2), strcat (char(1), char(2))) -%!assert (strcat ("", 2), strcat ([], char(2))) +%!assert (strcat (1, 2), strcat (char (1), char (2))) +%!assert (strcat ("", 2), strcat ([], char (2))) %!error strcat () diff --git a/scripts/strings/strchr.m b/scripts/strings/strchr.m --- a/scripts/strings/strchr.m +++ b/scripts/strings/strchr.m @@ -53,7 +53,7 @@ ## Index the str into a mask of valid values. ## This is slower than it could be because of the +1 issue. f = false (256, 1); - f(uint8(chars)+1) = true; + f(uint8 (chars) + 1) = true; ## Default goes via double -- unnecessarily long. si = uint32 (str); ## in-place is faster than str+1 diff --git a/scripts/strings/strjust.m b/scripts/strings/strjust.m --- a/scripts/strings/strjust.m +++ b/scripts/strings/strjust.m @@ -87,7 +87,7 @@ endif ## Adjust the column indices. - jdx += shift(idx); + jdx += shift (idx); ## Create a blank matrix and position the nonblank characters. y = repmat (" ", nr, nc); diff --git a/scripts/strings/strtok.m b/scripts/strings/strtok.m --- a/scripts/strings/strtok.m +++ b/scripts/strings/strtok.m @@ -75,7 +75,7 @@ ## Index the str into a mask of valid values. Faster for large N. f = false (256, 1); ## This is slower than it could be because of the +1 issue. - f(uint8(delim)+1) = true; + f(uint8 (delim)+1) = true; ## Default goes via double -- unnecessarily long. si = uint32 (str); ## in-place is faster than str+1 @@ -146,7 +146,7 @@ %! endif %! printf ("<%s>", s(1)); %! endwhile -%! printf("\n"); +%! printf ("\n"); %! % ---------------------------------------------------- %! % Demonstrates processing of an entire string split on %! % a variety of delimiters. Tokens and delimiters are diff --git a/scripts/strings/substr.m b/scripts/strings/substr.m --- a/scripts/strings/substr.m +++ b/scripts/strings/substr.m @@ -103,8 +103,8 @@ %!error substr () %!error substr ("foo", 2, 3, 4) %!error substr (ones (5, 1), 1, 1) -%!error substr ("foo", ones(2,2)) -%!error substr ("foo", 1, ones(2,2)) +%!error substr ("foo", ones (2,2)) +%!error substr ("foo", 1, ones (2,2)) %!error substr ("foo", 0) %!error substr ("foo", 5) %!error substr ("foo", 1, 5) diff --git a/scripts/strings/untabify.m b/scripts/strings/untabify.m --- a/scripts/strings/untabify.m +++ b/scripts/strings/untabify.m @@ -82,10 +82,10 @@ nr = rows (t); sc = cell (nr, 1); for j = 1:nr - n = 1:numel(t(j,:)); + n = 1:numel (t(j,:)); m = find (t(j,:) == "\t"); t(j,m) = " "; - for i = 1:numel(m) + for i = 1:numel (m) k = tw * ceil (n(m(i)) / tw); dn = k - n(m(i)); n(m(i):end) += dn; diff --git a/scripts/testfun/assert.m b/scripts/testfun/assert.m --- a/scripts/testfun/assert.m +++ b/scripts/testfun/assert.m @@ -43,10 +43,10 @@ ## Produce an error if observed is not the same as expected but equality ## comparison for numeric data uses a tolerance @var{tol}. ## If @var{tol} is positive then it is an absolute tolerance which will produce -## an error if @code{abs(@var{observed} - @var{expected}) > abs(@var{tol})}. +## an error if @code{abs (@var{observed} - @var{expected}) > abs (@var{tol})}. ## If @var{tol} is negative then it is a relative tolerance which will produce -## an error if @code{abs(@var{observed} - @var{expected}) > -## abs(@var{tol} * @var{expected})}. If @var{expected} is zero @var{tol} will +## an error if @code{abs (@var{observed} - @var{expected}) > +## abs (@var{tol} * @var{expected})}. If @var{expected} is zero @var{tol} will ## always be interpreted as an absolute tolerance. ## @end table ## @seealso{test, fail, error} @@ -249,9 +249,9 @@ %!assert (isempty ([])) %!assert (1) %!error assert (0) -%!assert (ones(3,1)) -%!assert (ones(1,3)) -%!assert (ones(3,4)) +%!assert (ones (3,1)) +%!assert (ones (1,3)) +%!assert (ones (3,4)) %!error assert ([1,0,1]) %!error assert ([1;1;0]) %!error assert ([1,0;1,1]) diff --git a/scripts/testfun/demo.m b/scripts/testfun/demo.m --- a/scripts/testfun/demo.m +++ b/scripts/testfun/demo.m @@ -65,7 +65,7 @@ ## Also, because demo evaluates within a function context, you cannot ## define new functions inside a demo. If you must have function blocks, ## rather than just anonymous functions or inline functions, you will have to -## use @code{eval(example("function",n))} to see them. Because eval only +## use @code{eval (example ("function",n))} to see them. Because eval only ## evaluates one line, or one statement if the statement crosses ## multiple lines, you must wrap your demo in "if 1 endif" ## with the 'if' on the same line as 'demo'. For example: @@ -112,7 +112,7 @@ if (n > 0) doidx = n; else - doidx = 1:length(idx)-1; + doidx = 1:(length (idx) - 1); endif for i = 1:length (doidx) ## Pause between demos diff --git a/scripts/testfun/example.m b/scripts/testfun/example.m --- a/scripts/testfun/example.m +++ b/scripts/testfun/example.m @@ -65,13 +65,13 @@ if (n > 0) doidx = n; else - doidx = 1:length(idx)-1; + doidx = 1:length (idx) - 1; endif if (isempty (idx)) warning ("no example available for %s", name); return; - elseif (n >= length(idx)) - warning ("only %d examples available for %s", length(idx)-1, name); + elseif (n >= length (idx)) + warning ("only %d examples available for %s", length (idx) - 1, name); return; endif diff --git a/scripts/testfun/fail.m b/scripts/testfun/fail.m --- a/scripts/testfun/fail.m +++ b/scripts/testfun/fail.m @@ -44,7 +44,7 @@ ## The angle brackets are not part of the output. ## ## Called with three arguments, the behavior is similar to -## @code{fail(@var{code}, @var{pattern})}, but produces an error if no +## @code{fail (@var{code}, @var{pattern})}, but produces an error if no ## warning is given during code execution or if the code fails. ## @seealso{assert} ## @end deftypefn @@ -70,7 +70,7 @@ pattern = "."; endif - ## allow assert(fail()) + ## allow assert (fail ()) if (nargout) ret = 1; endif @@ -83,9 +83,9 @@ state = warning ("query", "quiet"); warning ("on", "quiet"); try - ## printf("lastwarn before %s: %s\n",code,lastwarn); + ## printf ("lastwarn before %s: %s\n",code,lastwarn); evalin ("caller", sprintf ("%s;", code)); - ## printf("lastwarn after %s: %s\n",code,lastwarn); + ## printf ("lastwarn after %s: %s\n",code,lastwarn); ## Retrieve new warnings. err = lastwarn (); warning (state.state, "quiet"); @@ -131,15 +131,15 @@ %!fail ("[1,2]*[2,3]", "nonconformant") -%!fail ("fail('[1,2]*[2;3]', 'nonconformant')", "expected error but got none") -%!fail ("fail('[1,2]*[2,3]','usage:')", "expected error \nbut got.*nonconformant") -%!fail ("warning('test warning')", "warning", "test warning"); +%!fail ("fail ('[1,2]*[2;3]', 'nonconformant')", "expected error but got none") +%!fail ("fail ('[1,2]*[2,3]', 'usage:')", "expected error \nbut got.*nonconformant") +%!fail ("warning ('test warning')", "warning", "test warning"); -##% !fail ("warning('next test')",'warning','next test'); ## only allowed one warning test?!? +##% !fail ("warning ('next test')",'warning','next test'); ## only allowed one warning test?!? %% Test that fail() itself will generate an error %!error fail ("1") %!error fail ("a*[2;3]", "nonconformant") %!error fail ("a*[2,3]", "usage:") -%!error fail ("warning('warning failure')", "warning", "success") +%!error fail ("warning ('warning failure')", "warning", "success") diff --git a/scripts/testfun/speed.m b/scripts/testfun/speed.m --- a/scripts/testfun/speed.m +++ b/scripts/testfun/speed.m @@ -323,13 +323,13 @@ endif v = polyval (p, log (__test_n(tailidx))); - loglog (__test_n(tailidx), exp(v)*1000, sprintf ("b;%s;", order)); + loglog (__test_n(tailidx), exp (v) * 1000, sprintf ("b;%s;", order)); title ({"Time Complexity", __f1}); xlabel ("test length"); ## Get base time to 1 digit of accuracy. dt = exp (p(2)); - dt = floor (dt/10^floor(log10(dt)))*10^floor(log10(dt)); + dt = floor (dt/10^floor (log10 (dt)))*10^floor (log10 (dt)); if (log10 (dt) >= -0.5) time = sprintf ("%g s", dt); elseif (log10 (dt) >= -3.5) @@ -379,7 +379,7 @@ %! eval (fstr_build); %! %! disp ("Preallocated vector test.\nThis takes a little while..."); -%! speed("build (n)", "", 1000, "build_orig (n)"); +%! speed ("build (n)", "", 1000, "build_orig (n)"); %! clear -f build build_orig %! disp ("-----------------------"); %! disp ("Note how much faster it is to pre-allocate a vector."); @@ -408,7 +408,7 @@ %! eval (fstr_build); %! %! disp ("Vectorized test.\nThis takes a little while..."); -%! speed("build (n)", "", 1000, "build_orig (n)"); +%! speed ("build (n)", "", 1000, "build_orig (n)"); %! clear -f build build_orig %! disp ("-----------------------"); %! disp ("This time, the for loop is done away with entirely."); diff --git a/scripts/testfun/test.m b/scripts/testfun/test.m --- a/scripts/testfun/test.m +++ b/scripts/testfun/test.m @@ -145,7 +145,7 @@ fprintf (__fid, "# success (in which case no error will be reported).\n"); fflush (__fid); if (__close_fid) - fclose(__fid); + fclose (__fid); endif return; else @@ -184,7 +184,7 @@ endif endif if (__close_fid) - fclose(__fid); + fclose (__fid); endif return; endif @@ -204,12 +204,12 @@ endif endif if (__close_fid) - fclose(__fid); + fclose (__fid); endif return; else ## Add a dummy comment block to the end for ease of indexing. - if (__body (length(__body)) == "\n") + if (__body (length (__body)) == "\n") __body = sprintf ("\n%s#", __body); else __body = sprintf ("\n%s\n#", __body); @@ -233,7 +233,7 @@ __shared = " "; __shared_r = " "; __clear = ""; - for __i = 1:length(__blockidx)-1 + for __i = 1:length (__blockidx)-1 ## Extract the block. __block = __body(__blockidx(__i):__blockidx(__i+1)-2); @@ -251,7 +251,7 @@ __code = ""; else __type = __block(1:__idx(1)-1); - __code = __block(__idx(1):length(__block)); + __code = __block(__idx(1):length (__block)); endif ## Assume the block will succeed. @@ -270,11 +270,11 @@ __istest = 0; if (__grabdemo && __isdemo) - if (isempty(__demo_code)) + if (isempty (__demo_code)) __demo_code = __code; __demo_idx = [1, length(__demo_code)+1]; else - __demo_code = cstrcat(__demo_code, __code); + __demo_code = cstrcat (__demo_code, __code); __demo_idx = [__demo_idx, length(__demo_code)+1]; endif @@ -306,7 +306,7 @@ __code = ""; else __vars = __code (1:__idx(1)-1); - __code = __code (__idx(1):length(__code)); + __code = __code (__idx(1):length (__code)); endif ## Strip comments off the variables. @@ -354,7 +354,7 @@ __name = __block(__name_position(1):__name_position(2)); __code = __block; try - eval(__code); ## Define the function + eval (__code); ## Define the function __clear = sprintf ("%sclear %s;\n", __clear, __name); catch __success = 0; @@ -382,7 +382,7 @@ ### ERROR/WARNING - elseif (strcmp (__type, "error") || strcmp(__type, "warning")) + elseif (strcmp (__type, "error") || strcmp (__type, "warning")) __istest = 1; __warning = strcmp (__type, "warning"); [__pattern, __id, __code] = getpattern (__code); @@ -547,7 +547,7 @@ __ret1 = __ret2 = 0; endif if (__close_fid) - fclose(__fid); + fclose (__fid); endif return; endif @@ -644,7 +644,7 @@ ## Strip leading blanks from string. function str = trimleft (str) idx = find (isspace (str)); - leading = find (idx == 1:length(idx)); + leading = find (idx == 1:length (idx)); if (! isempty (leading)) str = str(leading(end)+1:end); endif @@ -666,7 +666,7 @@ ln = fgetl (fid); if (length (ln) >= 2 && strcmp (ln(1:2), "%!")) body = [body, "\n"]; - if (length(ln) > 2) + if (length (ln) > 2) body = cstrcat (body, ln(3:end)); endif endif @@ -683,29 +683,29 @@ ### Disable this test to avoid spurious skipped test for "make check" % !testif HAVE_FOOBAR % ! ## missing feature. Fail if this test is run -% ! error("Failed missing feature test"); +% ! error ("Failed missing feature test"); ### Test for a known failure -%!xtest error("This test is known to fail") +%!xtest error ("This test is known to fail") ### example from toeplitz %!shared msg1,msg2 %! msg1="C must be a vector"; %! msg2="C and R must be vectors"; -%!fail ('toeplitz([])', msg1); -%!fail ('toeplitz([1,2;3,4])', msg1); -%!fail ('toeplitz([1,2],[])', msg2); -%!fail ('toeplitz([1,2],[1,2;3,4])', msg2); +%!fail ('toeplitz ([])', msg1); +%!fail ('toeplitz ([1,2;3,4])', msg1); +%!fail ('toeplitz ([1,2],[])', msg2); +%!fail ('toeplitz ([1,2],[1,2;3,4])', msg2); %!fail ('toeplitz ([1,2;3,4],[1,2])', msg2); % !fail ('toeplitz','usage: toeplitz'); # usage doesn't generate an error -% !fail ('toeplitz(1, 2, 3)', 'usage: toeplitz'); +% !fail ('toeplitz (1, 2, 3)', 'usage: toeplitz'); %!test assert (toeplitz ([1,2,3], [1,4]), [1,4; 2,1; 3,2]); %!demo toeplitz ([1,2,3,4],[1,5,6]) ### example from kron %!#error kron # FIXME suppress these until we can handle output %!#error kron(1,2,3) -%!test assert (isempty (kron ([], rand(3, 4)))) +%!test assert (isempty (kron ([], rand (3, 4)))) %!test assert (isempty (kron (rand (3, 4), []))) %!test assert (isempty (kron ([], []))) %!shared A, B @@ -729,16 +729,16 @@ ### an extended demo from specgram %!#demo %! ## Speech spectrogram -%! [x, Fs] = auload(file_in_loadpath("sample.wav")); # audio file -%! step = fix(5*Fs/1000); # one spectral slice every 5 ms -%! window = fix(40*Fs/1000); # 40 ms data window -%! fftn = 2^nextpow2(window); # next highest power of 2 -%! [S, f, t] = specgram(x, fftn, Fs, window, window-step); -%! S = abs(S(2:fftn*4000/Fs,:)); # magnitude in range 0 test("test", 'bogus'); # incorrect args, generates error() +%!error test (1,2,3,4) # too many args, generates usage() +%!error test ("test", 'bogus'); # incorrect args, generates error() %!error garbage # usage on nonexistent function should be -%!error test("test", 'bogus'); # test without pattern +%!error test ("test", 'bogus'); # test without pattern %!test %! lastwarn(); # clear last warning just in case -%!warning warning('warning message'); +%!warning warning ('warning message'); %!## test of shared variables %!shared a # create a shared variable %!test a=3; # assign to a shared variable -%!test assert(a,3) # variable should equal 3 +%!test assert (a,3) # variable should equal 3 %!shared b,c # replace shared variables -%!test assert (!exist("a")); # a no longer exists -%!test assert (isempty(b)); # variables start off empty +%!test assert (!exist ("a")); # a no longer exists +%!test assert (isempty (b)); # variables start off empty %!shared a,b,c # recreate a shared variable -%!test assert (isempty(a)); # value is empty even if it had a previous value +%!test assert (isempty (a)); # value is empty even if it had a previous value %!test a=1; b=2; c=3; # give values to all variables %!test assert ([a,b,c],[1,2,3]); # test all of them together %!test c=6; # update a value -%!test assert([a, b, c],[1, 2, 6]); # show that the update sticks -%!shared # clear all shared variables -%!test assert(!exist("a")) # show that they are cleared -%!shared a,b,c # support for initializer shorthand +%!test assert ([a, b, c],[1, 2, 6]); # show that the update sticks +%!shared # clear all shared variables +%!test assert (!exist ("a")) # show that they are cleared +%!shared a,b,c # support for initializer shorthand %! a=1; b=2; c=4; -%!function x = __test_a(y) +%!function x = __test_a (y) %! x = 2*y; %!endfunction -%!assert(__test_a(2),4); # Test a test function +%!assert (__test_a (2),4); # Test a test function %!function __test_a (y) %! x = 2*y; %!endfunction %!test -%! __test_a(2); # Test a test function with no return value +%! __test_a (2); # Test a test function with no return value %!function [x,z] = __test_a (y) %! x = 2*y; %! z = 3*y; %!endfunction %!test # Test a test function with multiple returns -%! [x,z] = __test_a(3); -%! assert(x,6); -%! assert(z,9); +%! [x,z] = __test_a (3); +%! assert (x,6); +%! assert (z,9); %!## test of assert block -%!assert (isempty([])) # support for test assert shorthand +%!assert (isempty ([])) # support for test assert shorthand %!## demo blocks %!demo # multiline demo block diff --git a/scripts/time/now.m b/scripts/time/now.m --- a/scripts/time/now.m +++ b/scripts/time/now.m @@ -47,7 +47,7 @@ ## divided by 86400 sec/day plus day num for 1970-1-1 ## t = (time - mktime(gmtime(0)))/86400 + 719529; ## - ## mktime(gmtime(0)) does indeed return the offset from Greenwich to the + ## mktime (gmtime (0)) does indeed return the offset from Greenwich to the ## local time zone, but we need to account for daylight savings time ## changing by an hour the offset from CUT for part of the year.