octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #64156] [octave forge] (signal) xcov()-Functio


From: Dmitri A. Sergatskov
Subject: [Octave-bug-tracker] [bug #64156] [octave forge] (signal) xcov()-Function failed
Date: Sat, 6 May 2023 13:14:06 -0400 (EDT)

Follow-up Comment #3, bug #64156 (project octave):

The actual problem with xcorr.m and it is probably due to 
(mis)handling of varargin input. 


< function [R, lags] = xcorr (X, Y, maxlag, scale)
---
> function [R, lags] = xcorr (X, varargin)
143,151c144,168
< 
<   ## assign arguments that are missing from the list
<   ## or reassign (right shift) them according to data type
<   if nargin==1
<     Y=[]; maxlag=[]; scale=[];
<   elseif nargin==2
<     maxlag=[]; scale=[];
<     if ischar(Y), scale=Y; Y=[];
<     elseif isscalar(Y), maxlag=Y; Y=[];
---
>   vx = varargin
>   la = length(varargin)
>   na = nargin
> 
>   ## assign optional arguments according to data type
>   maxlag=[]; scale=[]; Y=[];
> 
>   for idx=1:length(varargin)
>     arg = varargin{idx}
>     if ischar(arg)
>       if isempty(scale)
>         scale = arg;
>       else
>         error ("xcorr: unexpected char value '%s' when scale is already set
to '%s'", arg, scale);
>       endif
>     elseif isscalar(arg)
>       if isempty(maxlag)
>         maxlag = arg;
>       else
>         error ("xcorr: unexpected scalar value '%f' when maxlag is already
set to '%f'", arg, maxlag);
>       endif
>     elseif idx == 1
>       Y = arg
>     else
>       error ("xcorr: unknown optional input variable at position %d", idx);



(Also note that 'arg" is a function in octave.)

Dmitri.
-- 



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?64156>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]