MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: function to check if array is empty


Your array is hardly "empty": it's full of zeros!

If what you want to do is test to see whether every entry is 0, the 
following will do it:

   And @@ Thread[0 == Flatten @ X]
]
will parr wrote:
> Dear Math Forum,
> 
> this probably already exists, but I can't find it anywhere:
> 
> is there a function that will check if an array is empty? 
> 
> i'm looking for a function to return either True (or 1), or False (or 0) when it checks an array. eg: 
> 
> X = Array[0 &, {3, 3}]
> 
> then test with function (called ArrayEmpty, for example)
> 
> In: ArrayEmpty[X]
> 
> Out: True
> 
> best wishes,
> 
> Will
> 

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305


  • Prev by Date: DSolve Issues
  • Next by Date: Re: For help about NSolve
  • Previous by thread: Re: function to check if array is empty
  • Next by thread: Re: function to check if array is empty