Skip to content

[Bug]: nwbExport error when the matnwb folder name has not been corrected #770

@maxdougherty

Description

@maxdougherty

What happened?

I downloaded the 2.9.0 release as a .zip and unzipped the folder on Windows. This left the matnwb folder named 'matnwb-2.9.0'. I added this folder and subfolders to my path, then attempted to run Example 1 from the nwbExport header using the code below resulting in the pasted error message. This seems to be caused by following line in NwbFile.m in the addWasGeneratedBy function.

169 matnwbInfo = ver('matnwb');

This implementation appears to expect that the unzipped release folder will be renamed to 'matnwb' before being added to the path. Calling ver('matnwb') here returns:

0×0 empty struct array with fields:

    Name
    Version
    Release
    Date

I consulted the documentation installation instructions, but I did not see any specific instructions to avoid this bug for new users. The error message did not make it clear that this was the source of the problem.

Steps to Reproduce

nwb = NwbFile;
nwb.session_start_time = datetime('now');
nwb.identifier = 'EMPTY';
nwb.session_description = 'empty test file';
nwbExport(nwb, 'empty.nwb');

Error Message

Error using types.util.validateShape (line 43)
Invalid shape for property "general_was_generated_by".

Error in types.core.NWBFile/validate_general_was_generated_by (line 602)
        types.util.validateShape('general_was_generated_by', {[2,Inf]}, val)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in types.core.NWBFile/set.general_was_generated_by (line 414)
        obj.general_was_generated_by = obj.validate_general_was_generated_by(val);
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in NwbFile/addWasGeneratedBy (line 173)
                    obj.general_was_generated_by = wasGeneratedBy;
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in NwbFile/export (line 58)
            obj.addWasGeneratedBy()
            ^^^^^^^^^^^^^^^^^^^^^^^
Error in nwbExport (line 52)
        nwbFileObjects(iFiles).export(filePath, mode);
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Caused by:
    Error using types.util.checkDims (line 56)
    Value of size [1 1] is invalid.  Must be one of:
        - Rank 2 with dimensions of size: [2 Any]

Operating System

Windows

Matlab Version

R2024b

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions