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

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

[Octave-bug-tracker] [bug #46385] Can't Repmat Structure Arrays


From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #46385] Can't Repmat Structure Arrays
Date: Fri, 1 Jul 2016 14:41:16 +0000 (UTC)
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0

Follow-up Comment #4, bug #46385 (project octave):

messing with this a little, there's a discrepancy with how Octave determines
the size of a struct array:


>> M = struct('a',ones(100),'b',true);

M = 

  scalar structure containing the fields:

    a = ***100x100 array of 1's***

    b = 1  ***stored as a logical***

>> size(M)
ans =

   1   1

>> size(M.a)
ans =

   100   100

>> size(M.b)
ans =

   1   1


now with repmat:


>> bigM=repmat(M,1,2)
bigM =

  1x2 struct array containing the fields:

    a
    b



Matlab 2016a reports it as:


>> bigM = repmat(M,1,2)
bigM = 
1x4 struct array with fields:
    a
    b


looking at how the element sizes are reported

Octave:

>> size(bigM)
ans =
   1   2
>> size(bigM.a)
ans =  100
>> size(bigM.b)
ans =  1
>> size(bigM(1).a)
ans =
   100   100
>> size(bigM(2).a)
ans =
   100   100
>> size(bigM(1).b)
ans =
   1   1
>> size(bigM(2).b)
ans =
   1   1


Matlab 2016a:
+verbatim
>> size(bigM)
ans =
     1     4
>> size(bigM.a)
Error using size
Too many input arguments. 
>> size(bigM.b)
Error using size
Too many input arguments. 
>> size(bigM(1).a)
ans =
   100   100
>> size(bigM(2).a)
ans =
   100   100
>> size(bigM(1).b)
ans =
     1     1
>> size(bigM(2).b)
ans =
     1     1


so, Octave returns 1x2 as the answer, Matlab 1x4. Maybe the size issue is some
of the cause of the problem. or is this a separate bug?

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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