the @spix class dot-properties
@spix dot-properties
Given the sp
@spix object, you can retrieve information from it using the "dot-property" syntax. As usual, note that the first 3 (case insensitive) characters are sufficient to define a property.
"global" object properties
sp.inf |
prints a summary of sp content |
sp.lab |
return the name of the object |
sp.inc |
returns the list of currently "included" units, by ID# |
sp.ink |
returns the list of currently "included" keys, by ID# |
Searching items within a @spix object with the find
property:
sp.fin('item') |
prints a message on whether the string 'item' exists as a label anywhere in the object and, if so, to what it corresponds |
object definition structures
Refer to the @spix class main reference page for more details on the following:
sp.uni |
returns a structure array containing information on the single units in sp |
sp.sub |
returns a structure array containing subset definitions |
sp.fac |
returns a structure array containing factor definitions |
sp.gro |
returns a structure array containing the key group definitions |
sp.com |
returns a structure array containing key combo definitions |
sp.key |
returns the @key object embedded in sp |
Indicizing definition structures
It is possible to select subsets of items from each of the definition structures by indicizing. For example:
>> u = sp.units(4:5);
But note that with sp.key(N)
, N
can only be a scalar. Read here for related information.
Instead of using ID#s as indices, you can use labels
more info on definition structures
It is possible to query each of the definition structures above by appending one of the following properties:
.count |
returns the number of items in a structure |
.list |
returns the list of ID#s in the structure |
.labels |
returns the list of item labels |
.keys |
returns the list of key ID#s in the structure (where applicable) |
.units |
returns the list of unit ID#s in the structure (where applicable) |
For example:
>> sp.units.cou ans = 12 >> sp.uni(4:5).lab ans = 'M02-1.0.2' 'M03-1.0.1' >> sp.uni({'M02-1.0.2', 'M03-1.0.1'}).list ans = 4 5
Complete list of valid calls
Given all the above, this is (I think) the complete list of valid dot-property calls, where s
can only be a single item, while X
is an array of items:
sp.name sp.label sp.info sp.includedunits sp.inkeys sp.units sp.units(X) sp.units.list sp.units(X).list sp.units.count sp.units(X).count sp.units.labels sp.units(X).labels sp.subsets sp.subsets(X) sp.subsets.list sp.subsets(X).list sp.subsets.count sp.subsets(X).count sp.subsets.labels sp.subsets(X).labels sp.subsets(s).units sp.keys sp.keys(s) sp.keys.list sp.keys(X).list sp.keys.count sp.keys(X).count sp.keys.labels sp.keys(X).labels sp.groups sp.groups(X) sp.groups.list sp.groups(X).list sp.groups.count sp.groups(X).count sp.groups.labels sp.groups(X).labels sp.groups(s).keys sp.combos sp.combos(X) sp.combos.list sp.combos(X).list sp.combos.count sp.combos(X).count sp.combos.labels sp.combos(X).labels sp.combos(s).keys sp.factors sp.factors(X) sp.factors.list sp.factors(X).list sp.factors.count sp.factors(X).count sp.factors.labels sp.factors(X).labels sp.factors(s).levels sp.factors(s).levels(X)
Examples
>> sp.info; this spix, named noname, contains: 12 units 1 subset(s) of units 48 keys 1 group(s) of keys 0 combination(s) of keys 2 factor(s) >> sp.units ans = 1x12 struct array with fields: label source date extra >> sp.unit(2) ans = label: 'M01-1.0.2' source: 'M01-1.0' date: '' extra: '' >> sp.unit(2).label ans = M01-1.0.2 >> sp.units.labels' ans = 'M01-1.0.1' 'M01-1.0.2' 'M02-1.0.1' 'M02-1.0.2' 'M03-1.0.1' 'M03-1.0.2' 'M04-1.0.1' 'M04-1.0.2' 'M05-1.0.1' 'M05-1.0.2' 'M05-2.0.1' 'M05-2.0.2'