Updated 23 Jan 2020
Implementation of AD Instruments SDK in Matlab
Jim Hokanson (2020). ADInstruments (LabChart) SDK (https://github.com/JimHokanson/adinstruments_sdk_matlab), GitHub. Retrieved .
@Misha - This particular code base is more about reading files rather than interacting with Labchart. I have another repo in which I've started to implement what you are asking for.
I've run into some issues doing this with channels sampled at higher rates (the rate I tried was 20 kHz) which I think is a problem on ADInsruments side of things. The callbacks occur every 50 ms or so. If you'd like feel free to email me and I'd be happy to work out more details. Alternatively, feel free to open an issue on that GitHub repo and I can respond there.
Hi, Is there any way to stream real time data from LabChart and get the values to a structure in MATLAB for further processing?
Hi Jonathan. My code relies on Windows drivers provided by ADInstruments. I don't see any such drivers for the Mac. The Windows version of Labchart does provide the option of exporting Matlab files, atlhough it didn't work so well. Perhaps there is one for macOS? I just notice my Platform Compatability says macOS and Linux which is not correct. I'll change that. Feel free to also reach out to your local ADInstruments rep to tell them to provide mac drivers ...
I'm trying to use this with Mac OS, however there is no compiled mex file for Mac. I'm trying to compile it, but not having any luck. Has this been tested on Mac?
My experience with Labchart has been that the install license is pretty permissive for installing on secondary computers for analysis, but your license setup may be different than mine. Regarding saving filters I was wrong. If my memory serves me correctly it turns out that checking the box next to a channel with a filter doesn't save the filtered data but rather the raw DAQ data for that channel. I'm pretty sure the Labchart server code does allow retrieval of the filtered data, but again you need to have Labchart open in order for that to work.
@ Jim, Thanks for the the details you provided. Let me think about it more as the computer I currently have MATLAB on does not have Labchart with our modules. In the meantime, I'd like to ask you another question. You replied to Laura that there is a way to save the filtered data in the channel settings. That may also work for me, but I am having trouble figuring out how to set up Labchart to save the filtered data. Is there any chance you have a URL or something else that would point me to instructions for doing that? Thanks!
This library does not support that functionality. It might be easy to extract this data using the Labchart server if I can find the right hooks. That approach would basically require letting Labchart be open on any computer analyzing the data while Matlab makes calls to Labchart. It is pretty easy to use but it does require Labchart to be on the computer and to wait for Labchart to open if it isn't. If that approach sounds reasonable feel free to send me a sample file with some events (make sure to let me know what modules you are using) and I'll try and see if I can extract them.
Hi! I'm enjoying the SDK implementation. I was wondering if there is a way to read "Event Marker" comments (see about half way down page: https://www.adinstruments.com/support/knowledge-base/how-does-matlab-open-exported-data)? If I define the output of adi.readFile as file_obj, then I can see the user defined comments through: file_obj.records(1,2).comments. (Note that file_obj.records(1,1).comments is empty). I am interested in finding the event markers (which are stored as comments using the LabChart MATLAB export, but I do not want to use that for reasons specified by Jim Hokanson) because I have LabChart setup to use cyclic measurements to identify every cycle of a heart beat. I'd like to do a beat-by-beat analysis of the data, without having to write my own matlab code to identify each heart beat. have access to that data. Thanks in advance for any thoughts!
Either the mex function isn't compiled or more likely you are running the function from within the adi folder. To run the code you should have the parent of the +adi folder on your path. Your current folder should not be the +adi folder.
Using function 'adi.readFile' or 'adi.convert' appear this message:
"Undefined function or variable 'sdk_mex'.
Error in adi/sdk/openFile (line 156) [result_code,pointer_value] = sdk_mex(0,h__toWChar(file_path));"
Assuming you are using floating point, the magnitudes should match. This code only works with channels that are saved to disk. So for example, if you typically store some raw data and then visualize it filtered in Labchart, you can't get that filtered data directly from this code (unless you save the filtered data to disk in your channel settings). If you think there may be another issue you are more than welcome to get in touch with me directly and we can work on resolving your issue.
This function outputs data that differs from the LabChart .mat export. The largest difference is in the amplitude sizes, though much of the signal behavior is preserved. I'm having some trouble debugging this. Has anyone had similar issues?
Thanks, you save me hours of work
Updated platform compatibility, only available for Windows