From maintainers-request at octave dot org Fri Jan 21 03:28:08 2005 Subject: Re: cell behavior From: David Bateman To: Daniel J Sebald Cc: octave maintainers mailing list Date: Fri, 21 Jan 2005 10:29:07 +0100 Daniel J Sebald wrote: > Is the following proper behavior of cell assignments? (2.1.64) > > octave:124> C = cell(2,1) > C = > > { > [1,1] = [](0x0) > [2,1] = [](0x0) > } > > octave:125> C(2) = [] > C = > > { > [1,1] = [](0x0) > } > > It could be interpretted two ways, but my intuition would be that C > should remain just as it already is. > > I have an iterative search that some times comes up empty. (I realize > it is possible to fix this with a conditional "isempty".) > > Dan Dan, This is intentional. The equivalent for a matrix might be octave:1> M = rand(2,2) M = 0.402375 0.721572 0.164786 0.040139 octave:2> M(:,2) = [] M = 0.40238 0.16479 Assigning a part of a matrix or cell array to the empty matrix has the effect of deleting that part of the matrix. Matlab v7sp1 gives the same result >> C = cell(2,1) C = [] [] >> C(2) = [] C = {[]} Octave and matlab also agree for the version "C{2} = []" which assigns an empty matrix rather than deletes the row. Maybe this is what you wanted to write.. Regards 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