|
From: | Thorsten Meyer |
Subject: | indexing cell arrays |
Date: | Sat, 06 Jun 2009 20:05:30 +0200 |
User-agent: | Mozilla-Thunderbird 2.0.0.19 (X11/20090103) |
Hi, Jaroslav Hajek wrote: Also, in the manual, there is an (obsolete) example that shows how to set elements of a cell array to [] withOn Sat, Jun 6, 2009 at 4:19 PM, Thorsten Meyer<address@hidden> wrote:Hi, While working on the documentation of container types, I found that it is no longer possible to assign to a subarray of cell array c like this: c{:,2} = 1Yes. The correct way is c(:,2) = {1}. I think c(:,2) = 1 still works as well. But c{:,2} was surely wrong, because it produces a cs-list (and thus represents a sequence of lvalues rather than one). c{:,2}= [] (generates an error in octave 3.1!) and eliminate elements with c(:,2) = [] I found, that the first of the two can now be achieved by c(:,2) = {[]} And the second still works, as does c(:,2) = 3 So a scalar gets promoted to a cell array with one entry, while the null_matrix has the special meaning of eliminating entries in a cell array (and other array types). Is this consistent with matlab? Thorsten |
[Prev in Thread] | Current Thread | [Next in Thread] |