MaxvandenBoom / matmef

Matlab wrapper for MEF library
GNU General Public License v3.0
1 stars 3 forks source link

MatMef

Matlab wrapper for MEF 3.0 library

This project provides Matlab (mex) functions to read and write MEF 3.0 data using the MEF 3.0 library

Using pre-compiled mex files

  1. Clone or download (and extract) the matmef repository
  2. Use the functions (as illustrated in the examples below)

Building from source

  1. Clone the matmef repository using: git clone https://github.com/MaxvandenBoom/matmef.git
  2. Start matlab and set the matmef folder as your working directory
  3. To compile the .mex files, run the following lines in matlab:

    • mex read_mef_session_metadata.c matmef_mapping.c mex_utils.c matmef_dataconverter.c
    • mex read_mef_ts_data.c matmef_read.c mex_utils.c matmef_dataconverter.c
    • mex init_mef_struct.c matmef_mapping.c mex_utils.c matmef_dataconverter.c
    • mex write_mef_segment_metadata.c matmef_write.c mex_utils.c matmef_utils.c matmef_mapping.c matmef_dataconverter.c
    • mex write_mef_ts_segment_data.c matmef_write.c mex_utils.c matmef_utils.c matmef_mapping.c matmef_dataconverter.c

Matlab usage examples

%  
% High-level  
%  

% metadata only  
[metadata] = readMef3('./mefSessionData/');

% two channels  
[metadata, signaldata] = readMef3('./mefSessionData/', [], {'Ch02', 'Ch07'});  

% all channels, samples 0-1000  
[metadata, signaldata] = readMef3('./mefSessionData/', [], [], 'samples', 0, 1000);  

% two channels, samples 0-1000  
[metadata, signaldata] = readMef3('./mefSessionData/', [], {'Ch02', 'Ch07'}, 'samples', 0, 1000);  

% all channels, multiple ranges/epochs
ranges = [[0,    1000]; ...
          [1000, 2000]; ...
          [5000, 6000]];
[metadata, signaldata] = readMef3('./mefSessionData/', [], [], 'samples', ranges);
%  
% Low-level  
%  

session = read_mef_session_metadata('./mefSessionData/', [], 1);  
data = read_mef_ts_data('./mefSessionData/channelPath/');  
data = read_mef_ts_data('./mefSessionData/channelPath/', [], 'samples', int64(0), int64(1000));
data = read_mef_ts_data('./mefSessionData/channelPath/', [], 'time', int64(1578715810000000), int64(1578715832000000));

Acknowledgements