Mercurial > octave
diff scripts/signal/movfun.m @ 28563:5a07c798eb08
avoid function call input or output argument number mismatch
Don't call functions with more inputs or outputs than they are defined
to accept. For example, always define graphics callback functions to
accept at least two arguments. To avoid creating unused variable
names, they may be defined as ignored (~).
* importdata.m: Call fileparts with three outputs, not four.
* inputParser.m: Define default validation function with ignored input.
* odemergeopts.m: Accept additional SOLVER argument.
* annotation.m, legend.m, movfun.m, bug-55321.tst: Define callback
functions with two inputs.
* annotation.m (addbasemenu): Also accept varargin.
* graphics.cc: Fix tests.
* pkg/private/install.m: Don't pass extra global_install argument to
getarchdir.
* sparse/private/__alltohandles__.m: Define function handles with two
inputs where needed.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 11 Jul 2020 10:15:57 -0400 |
parents | 9f9ac219896d |
children | 90fea9cc9caa |
line wrap: on
line diff
--- a/scripts/signal/movfun.m Sat Jul 11 09:34:44 2020 -0400 +++ b/scripts/signal/movfun.m Sat Jul 11 10:15:57 2020 -0400 @@ -328,7 +328,7 @@ ## Apply replacement value boundary conditions ## Window is padded at beginning and end with user-specified value. -function y = replaceval_bc (fcn, x, idxp, win, wlen) +function y = replaceval_bc (fcn, x, idxp, win, wlen, ~) persistent substitute; @@ -359,7 +359,7 @@ ## Apply "same" boundary conditions ## 'y' values outside window are replaced by value of 'x' at the window ## boundary. -function y = same_bc (fcn, x, idxp, win) +function y = same_bc (fcn, x, idxp, win, ~, ~) idx = idxp + win; idx(idx < 1) = 1; N = length (x); @@ -370,7 +370,7 @@ ## Apply "periodic" boundary conditions ## Window wraps around. Window values outside data array are replaced with ## data from the other end of the array. -function y = periodic_bc (fcn, x, idxp, win) +function y = periodic_bc (fcn, x, idxp, win, ~, ~) N = length (x); idx = idxp + win; tf = idx < 1;