[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #29942] concatenating with an empty scalar giv
From: |
Ben Abbott |
Subject: |
[Octave-bug-tracker] [bug #29942] concatenating with an empty scalar gives an error |
Date: |
Sun, 23 May 2010 15:24:39 +0000 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.55 Safari/533.4 |
Follow-up Comment #4, bug #29942 (project octave):
The Matlab code I found this in was written in 2002, and I'm running 2009b.
So this behavior appears to have been around a while.
Perhaps your recollection is with regards to cat()?
>> cat (1, zeros(1,0), 1)
??? Error using ==> cat
CAT arguments dimensions are not consistent.
>> cat (2, zeros(1,0), 1)
ans =
1
>> cat (2, zeros(0,1), 1)
??? Error using ==> cat
CAT arguments dimensions are not consistent.
>> cat (1, zeros(0,1), 1)
ans =
1
For cat(), Matlab and Octave behave the same way.
Mathwork's description for how "[...]" works is
"Vectors and matrices can be used inside [ ] brackets. [A B;C] is allowed if
the number of rows of A equals the number of rows of B and the number of
columns of A plus the number of columns of B equals the number of columns of
C. This rule generalizes in a hopefully obvious way to allow fairly
complicated constructions."
--
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/specialcharacters.html
The way Matlab functions isn't consistent, but I hesitate to conclude this is
due to a bug, a feature, or intent.
The original context was I discovered this in was ...
a = []
do ...
b = ...
a = [a(n:end);b]
end
I don't expect the typical user would realize that "a" and "a(n:end)" will
have different shapes when "a" is empty. So Mathworks may have chosen this
approach as a path of least resistance.
In either event, I agree that the way Octave behaves is consistent and
technically proper. So, I have no problem leaving it as it is. However, I'm
not sure if this is a Matlab bug or incompatibility on the part of Octave.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?29942>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #29942] concatenating with an empty scalar gives an error, Ben Abbott, 2010/05/22
- [Octave-bug-tracker] [bug #29942] concatenating with an empty scalar gives an error, Jaroslav Hajek, 2010/05/22
- [Octave-bug-tracker] [bug #29942] concatenating with an empty scalar gives an error, Ben Abbott, 2010/05/22
- [Octave-bug-tracker] [bug #29942] concatenating with an empty scalar gives an error, Jaroslav Hajek, 2010/05/23
- [Octave-bug-tracker] [bug #29942] concatenating with an empty scalar gives an error,
Ben Abbott <=
- [Octave-bug-tracker] [bug #29942] concatenating with an empty scalar gives an error, Jaroslav Hajek, 2010/05/24
- [Octave-bug-tracker] [bug #29942] concatenating with an empty scalar gives an error, Ben Abbott, 2010/05/24
- [Octave-bug-tracker] [bug #29942] concatenating with an empty scalar gives an error, Jaroslav Hajek, 2010/05/24
- [Octave-bug-tracker] [bug #29942] concatenating with an empty scalar gives an error, Ben Abbott, 2010/05/24
- [Octave-bug-tracker] [bug #29942] concatenating with an empty scalar gives an error, Jaroslav Hajek, 2010/05/24
- Message not available
- [Octave-bug-tracker] [bug #29942] concatenating with an empty scalar gives an error, Jaroslav Hajek, 2010/05/26
- [Octave-bug-tracker] [bug #29942] concatenating with an empty scalar gives an error, Jaroslav Hajek, 2010/05/28
- [Octave-bug-tracker] [bug #29942] concatenating with an empty scalar gives an error, Ben Abbott, 2010/05/28
- [Octave-bug-tracker] [bug #29942] concatenating with an empty scalar gives an error, Jaroslav Hajek, 2010/05/28
- [Octave-bug-tracker] [bug #29942] concatenating with an empty scalar gives an error, Ben Abbott, 2010/05/28