[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: using string as cell selectors
From: |
Jaroslav Hajek |
Subject: |
Re: using string as cell selectors |
Date: |
Thu, 2 Sep 2010 11:56:34 +0200 |
On Thu, Sep 2, 2010 at 11:40 AM, CdeMills <address@hidden> wrote:
>
> Hello,
>
> the dataframe class nearly passes all tests under 3.3.52+. The last problem
> is a failure in expressions like
> x.types{"Freq"} = 'uint32'
>
The length of the cs-list is evaluated by numel(x.types, "Freq"), so
if x.types returns a cell, it will be 4. Use x.types("Freq") to avoid
the cs-list problems, or x.types.Freq.
> The logic behind it is: x.types is of class 'cell', we should be able to
> select by column name.
>
> Under 3.2.4, the last part of S contains the string "Freq" in the field
> "subs". Under 3.3.52+, it fails with 'invalid assignement to cs-list outside
> multiple assignment".
>
> I checked under MatLab, the behaviour is to use the ascii code of chars as
> selectors: x.type{1} refers to the 49th value, and so on. So x.type{'Freq'}
> should refer to 4 values. This mechanism is also used in parenthesis
> derefencing. The only way in MatLab to have a selector as string is in
> x.('some string')
>
> Should we follow this path, or accept to have strings as element selectors
> everywhere ? If we go on the first hypothesis, how to translate actual
> expressions like
> x(1, "Freq")
> x.types{"Freq"}
>
Again, () doesn't generate cs-lists if it's not followed by . (dot).
x(1, "Freq") should be fine.
--
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz