Commit 616695b
Bugfix/subsref (#71)
* Issue #67 solved
This fixes both the infinite loop and the error on direct pars loading.
Corrected a typo and swapped a line, nothing to see here!
* Basically rewritten the subsref of tank and animal
I've rewritten the subsref of tank and animal to take care of some unexpected behavior. A Block revision will follow soon.
To summarize:
the {} operator can be used to access the children object in the layer below or two layers below. That means that you can access blocks and animals directly from the tank level.
eg
tankObj{aa} is equivalent to tankObj.Children(aa)
tankObj{aa,bb} is equivalent to tankObj.Children(aa).Children(bb)
animalObj changes it's behavior depending on the fact that's a scalar or a vector:
Scalar case
animalObj{bb} is equivalent to animalObj.Children(bb)
animalObj(bb,cc) is unsupported. Issues a warning and ignores all the indexes except bb, that means that is equivalent to animalObj.Children(bb).
Vector case
animalObj(bb) is unsupported. Issues an error.*
animalObj(aa,bb) is equivalent to animalObj(aa).Children(bb).
This is equivalent to tankObj{aa,bb}
Advanced Indexing:
You can address multiple objects at the same time, just use vectors as indexes.
E.g. aa = [1,2]; bb = 1; tankObj{aa,bb} will return the first block from the first two animals.
aa = [1,2]; bb = [1,3]; tankObj{aa,bb} will return the first and third block from the first two animals.
Indexes ('aa' and 'bb') can be numbers or Public Keys.
They work both interchangeably: this means you can use numerical indexes as first index and keys as second index. To address multiple objects at once using keys, stack them in cell arrays.
E.g. aa=[1,2]; bb=key1; tankObj{aa,bb} will look for key1 in all the blocks in animal 1 and 2.
aa = [1,2]; bb={key1,key2}; tankObj{aa,bb} will look for key1 and key2 in all the blocks in animal 1 and 2.
Asymmetrical indexing. This will be documented later on.
* defaults to test demo_nigelab + small bugfix
Updated defaults to test everything properly.
Swapped the order of a if elseif statemetn for advanced indexing.
* blockObj subsref update
BlockObj subsref is now working as intended (I believe)
By using {} in conjunction with defaults.Shortcuts, it is possible to access elements two levels under the current hierarchy level.
- Shortcurts now has a new format.
The struct format uses the shortcut keyword as the struct fieldname, Below that you can customize the fields to access and specify if those fields are indexable or not.
E.g let's say you wanted to access the first 100 samples in the Raw data. You would have to write:
blockObj.Channels(iCh).Raw(1:100);
With the shortcuts you configure the defaults by adding :
pars.raw.subfields = {'Channels', 'Raw'};
pars.raw.indexable = [true , true];
to the config file. Once that's done you can just call
blockObj{'raw',iCh,1:100};
let's explore another case. Let's say you wanted to access
blockObj.Streams.DigIO(iCh).data(1:100);
You would need to add to the config file
pars.digIO.subsfield = {'Streams', 'DigIO', 'data'};
pars.digIO.indexable = [false , true , true];
Streams is a not indexable field because is not vectorial. No () follows it.
Now typing
blockObj{'digIO',iCh,1:100};
will lead to the desired result.
- Advanced indexing.
Doc will be added later.
- Direct Channels access
All fields in Channels are also accessible directly from block:
E.g. blockObj.raw(iCh,1:100) is equivalent to blockObj.Channels(iCh).Raw(1:100);
The operator **end** is not available in shortcuts!
* Bugfixes, updates
------------------
# Bugfixes #
** Bugfixes **
## Major ##
** Major Bugs **
* Fixed issue where `B = tankObj{[1,2],key};` was throwing an error due to improper arrayfun indexing of substruct argument array.
## Minor ##
** Minor Bugs **
* `nigeLab.nigelObj/getPropertyGroups`
+ Call of tankObj{1} threw error because of unexpected naming convention used on demo dataset. Changed method to account for case where '+', '&', or '|' is used in addition to ' ' or '-' characters.
* `nigeLab.nigelObj/addPropListeners`
+ Getting an error I hadn't seen previously where it couldn't find the `checkBlocksForClones` or `checkAnimalsForClones` methods. Changed syntax in listener call and that fixed it even though effectively it should be the same reference? Not sure if this is related to subsref changes yet.
------------------
# Updates #
** Updates **
## Notable ##
** Notable Updates **
* Moved `IsRightKeyFormat` to be a method of `nigeLab.nigelObj`.
## Minor ##
** Minor Updates **
* Changed formatting on some comments, as well as indent stuff that I'm apparently retentive about.
* Fixed typos
Co-authored-by: Maxwell Murphy <max.murphy11@gmail.com>1 parent f79a88d commit 616695b
16 files changed
Lines changed: 760 additions & 351 deletions
File tree
- +nigeLab
- +defaults
- @Animal
- @Block
- private
- @Tank
- @nigelObj
- setup/demo
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
| 25 | + | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
74 | | - | |
| 73 | + | |
75 | 74 | | |
76 | 75 | | |
77 | 76 | | |
78 | | - | |
79 | | - | |
80 | | - | |
| 77 | + | |
| 78 | + | |
81 | 79 | | |
82 | 80 | | |
83 | 81 | | |
| |||
93 | 91 | | |
94 | 92 | | |
95 | 93 | | |
96 | | - | |
| 94 | + | |
97 | 95 | | |
98 | | - | |
| 96 | + | |
99 | 97 | | |
100 | 98 | | |
101 | 99 | | |
102 | 100 | | |
103 | | - | |
| 101 | + | |
104 | 102 | | |
105 | 103 | | |
106 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
28 | 44 | | |
29 | 45 | | |
30 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
82 | | - | |
| 81 | + | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
| |||
0 commit comments