liblsl-Matlab icon indicating copy to clipboard operation
liblsl-Matlab copied to clipboard

Error in loading liblsl in MATLAB

Open mustafam17 opened this issue 3 years ago • 7 comments

Hey everyone,

I'm attempting to get liblsl working with MATLAB R2019b. I've downloaded the correct release for my platform and MATLAB version as well as downloading the repository. After I set the correct path, I built the mex file, and I tried to load the library and called the first function lib = lsl_loadlib(); and then the second function version = lsl_library_version(lib) as it states in the README. Unfortunately, I recieved an error for the first function:

>> lib = lsl_loadlib(); version = lsl_library_version(lib) See https://github.com/labstreaminglayer/liblsl-Matlab/#troubleshooting for troubleshooting tips Error using lsl_loadlib (line 69) Error loading the liblsl library: Undefined function 'lsl_loadlib_' for input arguments of type 'char'.

I then went to Option 2 and 3, yet ran into the same exact issue each time.

I tried this same process on multiple devices, all with the same platform and MATLAB version, and also with the R2012a version, and I again ran into the same issue. Can someone let me know if there is any solution for this? Thanks.

mustafam17 avatar Sep 14 '21 15:09 mustafam17

Were you able to solve it? Running in the same issue here

SjoerdTimovanVliet avatar Oct 21 '22 12:10 SjoerdTimovanVliet

Hi, if any of you got any leads, do update. I'm also facing the same issue.

sudo-Pea avatar Dec 08 '22 06:12 sudo-Pea

Is the path to the folder that holds all the compiled .mex files on your path? On my machine this is <path_to>\Matlab\liblsl-Matlab\mex. I have my Matlab environment set up so that the folder <path_to>\Matlab and all of its subfolders are on the path.

load_lib_ (note the underscore) is the C function that is called in the script load_lib.m. If that is undefined, it is likely that Matlab doesn't know where to find it.

I just did a fresh download of the latest version (for Windows), ran the build_mex script (my system is configured so that the C codes i compiled with my MSVC 142 compiler) and everything works perfectly. If I remove the <path_to>\Matlab\liblsl-Matlab\mex folder I get a slightly different error, though.

dmedine avatar Dec 09 '22 03:12 dmedine

Hi, did you solve this problem? I'm also facing this issue.

SylviaYao avatar Dec 22 '22 08:12 SylviaYao

Hi , experiencing the same issue .was anyone able to figure it out?

EkgariKasawala avatar Mar 20 '23 20:03 EkgariKasawala

I found that when I had liblsl_Matlab located in my Box file, this error popped up, but as soon as I moved it just to my computer's documents, it disappeared and everything ran fine. I don't know why, but maybe that fix will work for some of you too.

gardenofejw avatar Oct 06 '23 17:10 gardenofejw

Same answer I provided in #31 , but reposting if It's helpful to someone!

I had the same issue running LSL on Matlab 2019b, The solution for me was to add the entire folder structure with subfolders to the path / or using addpath(genpath('path_to_liblsl-Matlab')); , rather than just the top-level folder.

ramkpari avatar Dec 13 '23 13:12 ramkpari