[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 17:56:24 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0 |
Follow-up Comment #7, bug #46385 (project octave):
apparently much of comments #4-6 can be disregarded. I had left M defined as
the already repmat'd struct way back at the start for the Matlab case, making
them look different. fixing that the outputs to almost all the code is
identical.
BUT, a difference does exist between Octave and Matlab output with the error
that Matlab produces for the one size call:
For both Octave and matlab:
>> M = struct('a',ones(100),'b',true);
>> bigM = repmat(M,1,2)
bigM =
1x2 struct array with fields:
a
b
>> size(bigM)
ans =
1 2
In Octave:
>> size(bigM.a)
ans = 100
In Matlab:
>> size(bigM.a)
Error using size
Dimension argument must be a positive integer scalar within indexing range.
from this output it appears that size(bigM.a) is using something as a second
size argument specifying one of the dimensions. Matlab yells that something
improper is being passed to that size argument (likely the second 100x100
array). If we use zeros(100) instead of ones(100) to make M:
>> M = struct('a',zeros(100),'b',true);
>> bigM = repmat(M,1,2)
bigM =
1x2 struct array containing the fields:
a
b
>> size(bigM.a)
error: size: requested dimension DIM (= 0) out of range
somewhat confirming that octave is taking the first element for size.
maybe size needs a varargin check to catch this?
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?46385>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #46385] Can't Repmat Structure Arrays, Nicholas Jankowski, 2016/07/01
- [Octave-bug-tracker] [bug #46385] Can't Repmat Structure Arrays, Nicholas Jankowski, 2016/07/01
- [Octave-bug-tracker] [bug #46385] Can't Repmat Structure Arrays, Nicholas Jankowski, 2016/07/01
- [Octave-bug-tracker] [bug #46385] Can't Repmat Structure Arrays,
Nicholas Jankowski <=
- [Octave-bug-tracker] [bug #46385] Can't Repmat Structure Arrays, Rik, 2016/07/01
- [Octave-bug-tracker] [bug #46385] Can't Repmat Structure Arrays, Lachlan Andrew, 2016/07/01
- [Octave-bug-tracker] [bug #46385] Can't Repmat Structure Arrays, Lachlan Andrew, 2016/07/01
- [Octave-bug-tracker] [bug #46385] Can't Repmat Structure Arrays, Nicholas Jankowski, 2016/07/01
- [Octave-bug-tracker] [bug #46385] Can't Repmat Structure Arrays, Nicholas Jankowski, 2016/07/01
- [Octave-bug-tracker] [bug #46385] Can't Repmat Structure Arrays, Lachlan Andrew, 2016/07/01