Open JimHokanson opened 4 months ago
I tested the code using the method "%If you want to do this in samples:" and it works. Thank you for your help. This code is very useful for my graduate thesis and research.
However, I have a question. Why does the data size differ each time I run the code? For example, I expect to "grab 5 samples in total," but sometimes it retrieves 105 samples.
I think this might be because "LabChart supports streaming via an event called OnNewSamples. This event is not channel specific. It gets called maybe every 50 ms (need to check this)," as you mentioned in https://github.com/JimHokanson/labchart_server_matlab/blob/master/documentation/streaming.md. There may be a time difference between requesting end_sample or nTicks and obtaining the actual data.
The delay between data acquisition and generation seems sufficient for my current research, but I am not sure of the exact delay. However, this might not be a critical issue.
Once again, thank you very much for your code on GitHub.
Someone emailed me asking: "each time I run a command in MATLAB, I want to get the current value from a specific channel in LabChart. What command should I use to achieve this with low latency?"
Here's my response. I should note I have not tested this yet ....
Note, both of these examples ASSUMES that you can go back that far. To be a bit more robust you would check that your start is > 0