README FIRST! Examples can fail in NEW MATLAB versions. Don't panic !

386 views
Skip to first unread message

marianux

unread,
Sep 14, 2017, 1:54:02 PM9/14/17
to ecg-ki...@googlegroups.com
Hi everybody ! Many users had problems running examples in newer Matlab versions. The issue is commonly caused by the readannot MEX compiled binary. Although this readannot.c should be compiled during installation, some newer Matlab versions have strong dependencies on certain compilers. In the following example, release 2017 only accepts gcc and g++ version 4.9. So make sure to recompile ecg-kit/common/*.c before asking for help. 

Example of recompilation for Matlab r2017

Since Matlab 2017 is only compatible with GNU compilers <= 4.9, to avoid problems make sure that your default compiler is the correct, otherwise the installation script will not be able to compile the MEX files:

sudo apt-get install gcc-4.9
sudo apt-get install g++-4.9
sudo apt-get install libstdc++-4.9-dev


Use the 4.9 as default gcc compiler

sudo ln -s /usr/bin/gcc-4.9 /usr/bin/gcc
sudo ln -s /usr/bin/g++-4.9 /usr/bin/g++

now check that the actual version is 4.9

gcc --version


This should not be a problem, since the kit includes several binaries, but just in case you would like to compile your owns.

Past Matlab versions used gcc-4.7 so this is also valid, just changing accordingly 4.9 by your correct version.


In Matlab command window define your correct path variables , 

  1. % first delete the old MEX binaries generated for my particular architecture
  2. root_path = 'your_path_to_ecgkit/';
  3. rm([common_path '*.' mexext])
then recompile for your particular architecture.

  1. common_path = [ root_path 'common' filesep];
  2. source_files = dir([ common_path '*.c'] );
  3. lsource_files = length(source_files);
  4.  
  5. for ii = 1:lsource_files
  6.     [~, source_file_name] = fileparts( source_files(ii).name);
  7.     mex_file = dir([common_path  source_file_name '.' mexext ]);
  8.     eval(['mex -outdir ''' common_path ''' ''' [common_path source_files(ii).name] '''']);
  9. end



Best,
Mariano.

Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages