BlackrockNeurotech/NPMK

Does openNSx really need r+ permissions?

cpandar opened this issue · 5 comments

On line 441 of openNSx.m, it opens the NSx file (via fopen) with 'r+' permissions. This gives it the ability to update the file. One often wants their data to be read-only, to lower the probability of accidentally overwriting the data files. If you do this, though (making your data read-only), because of the r+ permissions used in openNSx, the data fails to load.

So the question is whether the 'r+' permissions are necessary, or if a simple 'r' passed into fopen would do?

Apologies if I'm misunderstanding something.
Best, C

Thanks Kian. I ran it with an 'r' in place of the 'r+', and it worked fine (was able to successfully open an NS3 file and read some LFP data).

I scrolled through the code and I don't see any attempts to write back to the file, so it seems like 'r' should do it.

I definitely understand that...
If it's possible to include this in the next code update, that would be great (would allow us to not have to maintain a separate branch).