jimhokanson / adinstruments_sdk_matlab Goto Github PK
View Code? Open in Web Editor NEWImplementation of AD Instruments SDK in Matlab - i.e. reads LabChart files
License: MIT License
Implementation of AD Instruments SDK in Matlab - i.e. reads LabChart files
License: MIT License
Sometimes we break our files up into small chunks and add comments. I'd like to be able to move those comments back to the original file. This should be possible as every sample is time referenced absolutely (or can be resolved absolutely).
Hi
I always get this error message:
Warning: The following error was caught while executing 'adi.file_handle' class destructor:
Method 'delete' is not defined for class 'adi.file_handle' or is removed from MATLAB's search path.
when I do this:
function [data] = load_file(datafile)
addpath('adi');
data = adi.readFile(datafile);
...
rmpath('adi');
Is there a way to clean up before removing the path in order to avoid the error message?
best
Tobias
Hi,
when I run the adi.file_writer i receive the following error:
Error in adi.file_writer/startRecord (line 347)
in.trigger_time = sl.datetime.matlabToUnix(now);
I am running Matlab 2023a.
Best,
Patrick
If the mex file is cleared, trying to delete an old comment handle will crash Matlab. This is lower priority than the file handle since there is really no use in persisting the comment handle, but it should be fixed eventually.
The current fix to handling clearing mex and having invalid file handles is to check the time. This is currently using a second timer which means that it if you do:
open file
clear all (clears mex, calls delete on invalid pointer)
within the same second, you'll crash Matlab.
Currently, data can be retrieved in a time range, but you can only specify a single start and stop time. It would be useful to be able to return a single sci.time_series.data class which contains data from multiple ranges.
adinstruments_dsk_matlab+adi@channel\channel.m
if isempty(in.time_range)
%We populate this for comment retrieval
in.time_range = (in.data_range-1)/obj.fs(record_id);
else
in.data_range(1) = floor(in.time_range(1)*obj.fs(record_id))+1;
in.data_range(2) = ceil(in.time_range(2)*obj.fs(record_id))+1;
end
is it possible to have this on linux?
adi.convert()
was very helpful to successfully converted hundreds of .adicht files into .mat and thus make them readable in R. However the way the signals look, they seem to have been written with LabChart's filter settings. As far as I know, the signals are stored in raw form, and filtering is always post-processing. Is there an option/argument in the adi.convert()
function that would allow us to export the raw data? Thanks.
The sl dependencies are minimal enough that I should just remove them or copy over the functions.
sl - standard libary - https://github.com/JimHokanson/matlab_standard_library
Hi Jim,
first of all thanks a ton for sharing this code, which already works fantastic!
However, using R.matlab
package in R I ran into an issue. The package wants v6
.mat files but your code is generating v7
.mat files. According to the R error message below one should use save -V6
(or probably use an older Matlab version). I looked into your code but since I am not very proficient in Matlab, I don't know where to set the parameter. Maybe you could help?
Cheers
> R.matlab::readMat('foo.mat')
Error in readMat5(con, firstFourBytes = firstFourBytes, maxLength = maxLength) :
Reading of MAT v7.3 files is not supported. If possible, save the data in MATLAB using 'save -V6'.
Hello,
This is a cool toolbox. I am trying to use it in Matlab on Linux, but it seems I cannot add '.../adinstruments_sdk_matlab/+adi/' into pathes. Should I remove '+'?
Many thanks!
Hello,
i want to write long eeg recordings to a .adidat file. However, it crashes during the stopRecording command. You can find the code I'm using below (it generates example data, but the same happens with the acutal data):
file_path = 'path_to_\test.adidat';
fw = adi.createFile(file_path);
fs1 = 250;
chan = 1;
pres_chan = fw.addChannel(chan,'pressure',fs1,'cmH20');
fs2 = 250;
chan = 2;
pres2_chan = fw.addChannel(chan,'emg',fs2,'mV');
fw.startRecord();
y1(1:65000000) = 1.23456789;
pres_chan.addSamples(y1);
y2(1:65000000) = 1.23456789;
pres2_chan.addSamples(y2);
fw.stopRecord(); %<-- here it crashes
If I am writing the same (or twice) the number of datapoints into one channel, everything works fine. I attached the Matlab crash report. Do you have any idea what might cause the crash?
Thanks a lot for your amazing work!
Best, Patrick
Working with 0 based numbering in Matlab is very confusing. Shift everything to use 1 based numbering on the Matlab side, and then fix this in the SDK so that the dll calls get the 0 based numbering.
Hi, I want to create "adicht" file in Matlab and import it for our medical students to Labstation. However, Labstation supports file versions LabChart 8 or newer. Is there a chance to upgrade the code to save in such file format?
Thank you Jakub
UsingMATLAB R2020b on 64bit Windows 10 Enterprise.
Set up the sdk with ''addpath("...XXX....\adinstruments_sdk_matlab");', then tried to run 'f = adi.readFile("testData.adicht")' and there was no error, but there was also no 'f' object created. What could be going wrong?
On Matlab 2020b, loading the class generates some warnings:
Warning: File: file.m Line: 25 Column: 20
Unrecognized pragma "%# of channels in the file (across all records). This may".
Warning: File: file.m Line: 150 Column: 13
Unrecognized pragma "%# of comments".
Warning: File: record.m Line: 13 Column: 19
Unrecognized pragma "%# of samples of highest sampling rate channel".
You could just add a space between to two characters ("% #" to avoid the Matlab parser trying to interpret it.
Having the mex code visible to tab completion is driving me nuts!
Hi Jim,
If I try to run the sdk on linux I run into this error:
Sensorprams=adi.readFile(sensordata_path)
Unrecognized function or variable 'sdk_mex'.
Error in adi/sdk/openFile (line 156)
[result_code,pointer_value] = sdk_mex(0,h__toWChar(file_path));
Error in adi/readFile (line 68)
file_h = sdk.openFile(file_path);
I think there is an issue with mex on linux.
Any Idea how to fix this?
Best regards,
Thomas
This is not possible with the C SDK. It may be possible with the COM SDK ...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.