NeurodataWithoutBorders / matnwb

A Matlab interface for reading and writing NWB files
BSD 2-Clause "Simplified" License
50 stars 32 forks source link

Cannot explicitly assign a value to a true property of a Group #4

Closed mcafaro closed 6 years ago

mcafaro commented 6 years ago

Attempting to explicitly assign a value to a "true" property of a group throws an error:

>> g1 = types.untyped.Group();
>> g2 = types.untyped.Group();
>> g1.groups.g2 = g2
Error using containers.Map/subsref
The specified key is not present in this container.

Error in util.StructMap/subsasgn (line 59)
              tempobj = obj.map(subv);

Error in types.untyped.Group/subsasgn (line 77)
          obj = builtin('subsasgn', obj, s, r);

I believe this is important because if a Group cannot distinguish between an attribute and a dataset, you need a way to explicitly tell it which to use.

>> g1.a1 = [1 2 3]
Error using types.untyped.Group/subsasgn (line 69)
Group:subsasgn: please specify whether this numeric value is in 'attributes' or 'datasets'

Failing test:

>> nwbtest('ProcedureName', 'testGroupDotSubsasgnGroup')
lawrence-mbf commented 6 years ago

With the refactoring of matnwb, there are no longer untyped Groups. Untyped sets are a much simpler wrapper around containers.Map with their own validation functions.