[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Deleting cell elements with a(x) = [];
From: |
David Bateman |
Subject: |
Deleting cell elements with a(x) = []; |
Date: |
Wed, 25 Aug 2004 18:05:26 +0200 |
User-agent: |
Mutt/1.4.1i |
One of the things on Johns todo list for octave 3.0 was deleting
cell array elements with a syntax like "a(x) = []". Checking against
a matlab R12 version I find the following behaviour...
>> a = cell(1,3); a{1} = 1; a{2} = 2; a{3} = 3, a{2} = [], a(2) = []
a =
[1] [2] [3]
a =
[1] [] [3]
a =
[1] [3]
So that is indexing a cell array with "{}" and passing an empty RHS
results in a empty matrix inserted into the cell array, while doing the
same thing while indexing with "()" deletes the element of the array.
The fact is this is quite trivial to implement in octave, as the following
patch shows. After applying this patch I get the following behaviour
octave:1> a = cell(1,3); a{1} = 1; a{2} = 2; a{3} = 3, a{2} = [], a(2) = []
a =
{
[1,1] = 1
[1,2] = 2
[1,3] = 3
}
a =
{
[1,1] = 1
[1,2] = [](0x0)
[1,3] = 3
}
a =
{
[1,1] = 1
[1,2] = 3
}
Regards
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
changelog-cell20040825
Description: Text document
patch.cell20040825
Description: Text document
- Deleting cell elements with a(x) = [];,
David Bateman <=