Skip to content

Commit 77e997d

Browse files
committed
Updated README to clarify setup instructions.
1 parent e8e4dcf commit 77e997d

File tree

2 files changed

+35
-14
lines changed

2 files changed

+35
-14
lines changed

README.md

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,47 @@
11
This is the MATLAB interface for liblsl.
22

3-
## Use
3+
## Download & Install
44

5-
* You need to add this directory to your MATLAB path recursively
5+
### Official Release
6+
7+
First try getting the latest release for your platform and Matlab version from [the release page](https://github.com/labstreaminglayer/liblsl-Matlab/releases). Unfortunately, Matlab is very strict about using the exact right versions of binaries, and there is no easy way to automate Matlab releases ([see #17](https://github.com/labstreaminglayer/liblsl-Matlab/issues/17)), so it is very much a matter of luck as to whether or not we happen to have a release that will work for you.
8+
9+
### From Source
10+
11+
Instead, you can download the source, the dependencies, and build yourself. This may sound intimidating but we've tried to automate some of the work for you. If you're lucky then it might be easier than you think.
12+
13+
1. Clone or download a zip of this repository from https://github.com/labstreaminglayer/liblsl-Matlab
14+
* If you downloaded the zip, extract it somewhere convenient.
15+
2. Add an up-to-date build of the liblsl binary to the `liblsl-Matlab/bin/` directory.
16+
* Option 1: Do nothing and it will download automatically when first required.
17+
* This might fail, or even if it succeeds in downloading the file, you might still get errors trying to load the library. Try Option 2 next.
18+
* Option 2: Download precompiled libraries from the [liblsl release page](https://github.com/sccn/liblsl/releases)
19+
* See [here](https://labstreaminglayer.readthedocs.io/info/faqs.html#binaries) for more information about which library you need.
20+
* This doesn't always work, unfortunately. Try option 3.
21+
* Option 3: Build it yourself.
22+
* [See here](https://labstreaminglayer.readthedocs.io/dev/lib_dev.html) for instructions.
23+
3. Build the mex files.
24+
* In Matlab: Change Matlab's working directory to this repository's root (i.e., liblsl-Matlab) and run `build_mex`.
25+
* From the command line: `matlab -nodesktop -nosplash -r 'build_mex'`
26+
* You may need to install a compiler. [See here for supported compilers](https://www.mathworks.com/support/requirements/supported-compilers.html). For Windows users, this usually means installing [Visual Studio](https://visualstudio.microsoft.com/downloads/).
27+
28+
## How to Use
29+
30+
1. Add this folder to your MATLAB path recursively
631
* Using the MATLAB GUI, use File/Set Path...
732
* Alternatively, in a script, use `addpath(genpath('path/to/liblsl-Matlab'));`
8-
* The `bin/` directory needs to contain an up-to-date build of the library file for your MATLAB version.
9-
* see [here](https://labstreaminglayer.readthedocs.io/info/faqs.html#binaries) for more information about which library you need
10-
* download precompiled libraries from the [liblsl release page](https://github.com/sccn/liblsl/releases)
11-
* e.g. `liblsl64.dll` for 64-bit MATLAB on Windows. (Note: Next LSL releases will change these to `lsl.dll`)
12-
* e.g. `liblsl64.dylib` and `liblsl64.1.4.0.dylib` for 64-bit MATLAB on MacOS.
13-
* e.g. `liblsl64.so` and `liblsl64.so.1.4.0` for 64-bit MATLAB in Linux
14-
* Once this taken care of, see the example files in the examples/ directory for how to use this interface in a MATLAB program.
33+
2. Load the library then call a function.
34+
* `lib = lsl_loadlib(); version = lsl_library_version(lib)`
35+
3. See the example files in the examples/ directory for more examples of how to use this interface in a MATLAB program.
1536

1637
### Simulink
1738

1839
[See here](https://bitbucket.org/neatlabs/simbsi/wiki/LSL%20signal%20acquisition%20example).
1940

2041
### Troubleshooting
2142

22-
If you get an error similar to `lsl_loadlib_ undefined`, then you may need to run the `build_mex.m` script from within the liblsl-Matlab directory.
23-
(From the command line: `matlab -nodesktop -nosplash -r 'build_mex'`)
24-
25-
If `build_mex` seems to have completed successfully but the error persists, please make sure the liblsl-Matlab/bin folder is on the path.
43+
If you get an error similar to `lsl_loadlib_ undefined`, then try following the "From Source" directions above.
2644

2745
On MacOS, you may still get an error similar to `Invalid MEX-file [...] lsl_loadlib_.mexmaci64; Reason: image not found.`. To fix this run the following command in a Terminal window from within the liblsl-Matlab directory: `install_name_tool -add_rpath "@loader_path/" bin/lsl_loadlib_.mexmaci64`
46+
47+
If you still can't get it to work then open an issue here and hopefully someone who has the same platform and Matlab version as you can build and upload a release for you.

bin/readme.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
Please make sure that you have the most recent binaries from liblsl/bin/ in here.
1+
This folder should contain a recent version of the liblsl binary as well as the built mex files.
2+
See the parent folder's README.md for details.

0 commit comments

Comments
 (0)