Hi Sarah,
Thanks, this is more clear to me knowing your description. You can choose the layout with which MatrixWriter saves the data in the file (ColumnMajor or RowMajor), but bear in mind that only ColumnMajor makes intuitive sense for arbitrarily streaming long files (i.e. where you don't know the length of the time axis apriori). The reason is that if you wanted to store the data the other way around, one channel at a time, you would have to know the total number of samples beforehand before jumping to the next channel, if that makes sense.
This is why in general the default assumed by MatrixWriter is ColumnMajor, where rows represent time, and columns represent channels. Depending on how you load data in matlab, you will indeed have to reshape the data appropriately.
Regarding timestamping, I wouldn't advise just working out sample timing from start and stop of recording as there might be non-negligible clock drift, especially if you go for long recordings. It might be more helpful to just use CombineLatest again in this case to work out timing.
One trick to do this is to generate a "virtual channel" which will contain the latest frame number and which will be appended to the data coming from the NI-DAQ. The way to generate this is to use ScalarBuffer to generate a fake buffer every frame with a value set to the frame index. That way you will end up with a "staircase" like pattern in your binary files where that channel will tell you for every sample what was the latest frame that Bonsai held in hand at the time of buffer acquisition. The logic for this can be simplified into an example with AudioCapture, like so (also attached):
In this example, AudioCapture is a stand-in for my DAQ, and CameraCapture is a stand-in for your combined video source. CombineLatest is simply taking the latest frame counter buffer from the camera whenever there is more data, and appending (Concat Axis:0) that channel to the data and dumping everything into a file.
If you plot that data afterwards, you will have two channels in your file which look like this:
The left side is the "analog" raw data and the right side is our fake frame counter data, which has the staircase pattern, but basically tells me for every recorded sample what was the latest buffer in memory. As we discussed, this might have a deterministic jitter (which hopefully is negligible) but there should be no drift over time.
Hope this helps.