help-octave
[Top][All Lists]
Advanced

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

Re: Why does this not work?


From: David Bateman
Subject: Re: Why does this not work?
Date: Fri, 26 Nov 2004 17:34:05 +0100
User-agent: Mutt/1.4.1i

According to Ananda Murthy R S <address@hidden> (on 11/26/04):
> Hello,
> 
> I am unable to find why the code given below does not
> print the required result in Octave 2.1.63. I am
> running this version on Slackware 10.
> 
> n=[];
> if (n==[]);
> printf("n is empty");
> endif

This went for compatiablity I believe since  "n == []" is technically an
empty matrix. I believe matlab R13 and later do it this way, though I
can't confirm..... To see why it is incorrect consider 

a = round(randn(2,2));
a == 0

ans =

  0  0
  0  0

So what to do get when the matrix is empty but another empty matrix.

You should use "isempty" instead and in that way you'll know it is 
compatiable everywhere...

Cheers
David

-- 
David Bateman                                address@hidden
Motorola CRM                                 +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 1 69 35 77 01 (Fax) 
91193 Gif-Sur-Yvette FRANCE

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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