SpikeGLX – Fetch()

One thing I learned the hard way: when using SpikeGLX’s matlab API, the function Fetch() does not return channels in the order you requested them. For example, let’s say we do:

[matDataNI,intStartCountNI] = Fetch(hSGL, intStreamNI, intStartFetch, intRetrieveSamplesNI, [3 1],intDownsampleNI);

One would then expect matDataNI to return channels in the order [3 1], but in fact Fetch() does not care about the query order and sorts the channels itself. It therefore instead returns the channels in the order [1 3]. I would call it a bug, but I suppose others might call it feature… Just be aware of how Fetch() behaves!