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

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

[Octave-bug-tracker] [bug #35481] [var{:}] does not collapse empty eleme


From: Philip Nienhuis
Subject: [Octave-bug-tracker] [bug #35481] [var{:}] does not collapse empty elements when some elements are cell
Date: Wed, 08 Feb 2012 20:40:32 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.11) Gecko/20100701 SeaMonkey/2.0.6

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

You say "consistent with Matlab" - did you check if this is DOCUMENTED
behavior of Matlab?


octave:5> [1 [] {1} 'a']
ans =
{
  [1,1] =  1
  [1,2] = [](0x0)
  [1,3] =  1
  [1,4] = a
}
octave:6> ans(2) = []
ans =
{
  [1,1] =  1
  [1,2] =  1
  [1,3] = a
}
octave:7> iscell ([1 [] {1} 'a'])
ans = 1

...so Octave translates it into a cell array, as ML does, because you try to
concatenate mixed types (one of the types is a 1x1 cell array).
But to then suggest that Octave is buggy because it doesn't skip the empty
cell is too fast IMO - for the same token this could be a Matlab bug.


octave:8> [1 [] 'a']
ans = ☺a
octave:9> int8([1 [] 'a'])
ans =

   1  97
octave:10> iscell ([1 [] 'a'])
ans = 0
octave:11> [1 [] 'a']
ans = ☺a
-verbatim
....which shows that Octave makes a it character array. Here [] is ignored
with good reason.

Interestingly,

octave:14> [1 [] {} 'a']
ans =
{
  [1,1] =  1
  [1,2] = [](0x0)
  [1,3] = a
}

...so there may be something fishy.

Please check what the ML docs say about this all.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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