matnwb icon indicating copy to clipboard operation
matnwb copied to clipboard

[Bug]: Removing neurodata type from file does not work

Open ehennestad opened this issue 10 months ago • 0 comments

What happened?

If a group or dataset is removed from an NWB file object which is read from disk, and the NWB file object is exported to the same file path, the group or dataset will still be present the next time the file is read in.

Steps to Reproduce

>> run('ophys');
- - - 
>> nwb = nwbRead('ophys_tutorial.nwb');
>> nwb.processing.get('ophys').nwbdatainterface

ans = 

  3×1 Set array with properties:

         Fluorescence: [types.core.Fluorescence]
    ImageSegmentation: [types.core.ImageSegmentation]
     MotionCorrection: [types.core.MotionCorrection]

>> nwb.processing.get('ophys').nwbdatainterface.remove("Fluorescence")

ans = 

  2×1 Set array with properties:

    ImageSegmentation: [types.core.ImageSegmentation]
     MotionCorrection: [types.core.MotionCorrection]

>> nwbExport(nwb, 'ophys_tutorial.nwb')
>> nwb = nwbRead('ophys_tutorial.nwb');
>> nwb.processing.get('ophys').nwbdatainterface

ans = 

  3×1 Set array with properties:

         Fluorescence: [types.core.Fluorescence]
    ImageSegmentation: [types.core.ImageSegmentation]
     MotionCorrection: [types.core.MotionCorrection]

>>

Error Message

No error

Operating System

Windows

Matlab Version

R2023b

Code of Conduct

ehennestad avatar Jan 16 '25 15:01 ehennestad