Using the NwbFile Class

The NwbFile class represents the root object for the NWB file and consists of properties and values which map indirectly to the internal HDF5 dataset.


In most cases, the types contained in these files were generated by the embedded NWB schema in the file (or separately if you opted to generate them separately). These types can be traversed using regular MATLAB syntax for accessing properties and their values.

Aside from the generated Core and Extension types, there are “Untyped” utility Types which are covered in greater detail in Utility Types in MatNWB.

Searching by Type

The NwbFile also allows for searching the entire NWB file by type using its searchFor method.

You can search for only the class name:


Or use the 'includeSubClasses' optional argument to search all subclasses:



As seen above, the keys to searchFor method’s returned Map can be paired with the resolve method to effectively retrieve an object from any NwbFile. This is also true for internal HDF5 paths.