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

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

[Octave-bug-tracker] [bug #37390] In matlab repmat can have empty inputs


From: Richard
Subject: [Octave-bug-tracker] [bug #37390] In matlab repmat can have empty inputs
Date: Sat, 22 Sep 2012 09:35:01 +0000
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:10.0.3) Gecko/20100101 Firefox/10.0.3

Follow-up Comment #2, bug #37390 (project octave):

I realised I made a mistake when I first reported this. 

Repmat does not replace empty values with 1, it ignores them and treats the
non-empty values as if they were the first argument:

>> repmat([1,2,3], [], 4)

ans =

     1.0000e+000     2.0000e+000     3.0000e+000
     1.0000e+000     2.0000e+000     3.0000e+000
     1.0000e+000     2.0000e+000     3.0000e+000
     1.0000e+000     2.0000e+000     3.0000e+000

>> repmat([1,2,3], 4, [])

ans =

     1.0000e+000     2.0000e+000     3.0000e+000
     1.0000e+000     2.0000e+000     3.0000e+000
     1.0000e+000     2.0000e+000     3.0000e+000
     1.0000e+000     2.0000e+000     3.0000e+000

so your patch is not quite right. Something like the following might work:

# check second arg first so it will be one if both 
# m and n are empty
if (isempty (n))
    n = 1;
endif
if (isempty (m))
    m = n;
    n = 1;
endif

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?37390>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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