From bug-request at octave dot org Fri Nov 26 10:37:06 2004 Subject: Re: Why does this not work? From: David Bateman To: Ananda Murthy R S Cc: help at octave dot org, bug@octave.org Date: Fri, 26 Nov 2004 17:34:05 +0100 According to Ananda Murthy R S (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 David dot Bateman at motorola dot com 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 -------------------------------------------------------------