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: Garrett
Subject: [Octave-bug-tracker] [bug #35481] [var{:}] does not collapse empty elements when some elements are cell
Date: Wed, 08 Feb 2012 21:55:10 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20100101 Firefox/10.0

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

A little more testing along that line of thought:


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



So Octave cells the elements if there are cell array elements present (empty
or not) in the concatenation operation and then deletes the empty cells but
only if they were empty cells going in.

Those operations in Matlab all produce the same output:


>> [1 [] {} 'a']

ans = 

    [1]    'a'

>> [1 [] {} {} 'a']

ans = 

    [1]    'a'

>> [1 [] [] {} {} 'a']

ans = 

    [1]    'a'


I think I'll leave this alone as it is deep in undocumented territory it
seems.  Also it was easy enough to write a function called cellcat which drops
the empty elements:


function [x]=cellcat(varargin)
x=[varargin{~cellfun('isempty',varargin)}];
end



    _______________________________________________________

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]