The local copy of the data matrix Y can be cleared before calling nnmf for the background(s). In greedyROI_corr this avoids an out-of-memory crash during one of the matrix division operations in some of my datasets; in greedyROI I haven't found that to happen, but clearing the local variable shouldn't cause issues. Actually I can't say I understand why matlab's garbage collector doesn't take care of it.
The local copy of the data matrix Y can be cleared before calling nnmf for the background(s). In greedyROI_corr this avoids an out-of-memory crash during one of the matrix division operations in some of my datasets; in greedyROI I haven't found that to happen, but clearing the local variable shouldn't cause issues. Actually I can't say I understand why matlab's garbage collector doesn't take care of it.