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

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

[Octave-bug-tracker] [bug #63776] padarray varargin argument incompatibi


From: anonymous
Subject: [Octave-bug-tracker] [bug #63776] padarray varargin argument incompatibility with MATLAB
Date: Wed, 8 Feb 2023 19:07:15 -0500 (EST)

URL:
  <https://savannah.gnu.org/bugs/?63776>

                 Summary: padarray varargin argument incompatibility with
MATLAB
                 Project: GNU Octave
               Submitter: None
               Submitted: Thu 09 Feb 2023 12:07:13 AM UTC
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 7.3.0
         Discussion Lock: Any
        Operating System: GNU/Linux
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Thu 09 Feb 2023 12:07:13 AM UTC By: Anonymous
In MATLAB the function padarray can be called with 3 arguments:

padarray(A, padsize, direction)

as well as 4 arguments:

padarray(A, padsize, padval, direction)


Example:
A = ones(4,4);
B = padarray(A,[2 0],'pre')
B =
     0     0     0     0
     0     0     0     0
     1     1     1     1
     1     1     1     1
     1     1     1     1
     1     1     1     1


The Octave code doesn't detect the 3-argument usage. Simple fix is to handle
another nargin case, added in *bold*.

-----------------------------------------------------------------
function B = padarray(A, padsize, padval, direction)

% Check parameters
if (nargin<2 || nargin>4)
    usage ("B = padarray(A, padsize [, padval] [, direction])");
end
if (nargin<3)
    padval=0;
end
*if (nargin==3) && ischar(padval)*
    *direction = padval;*
    *padval = 0;*
*else*if (nargin<4)
    direction='both';
end







    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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