<div dir="ltr">Hi Jose,<div><br></div><div>I ran into similar dependencies issues when compiling fieldtrip, and converged on the following:</div><div><br></div><div><p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;min-height:12px"> </p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">% these paths will be added at compilation</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">addpath(genpath(<span style="color:rgb(178,69,243)">'~/code/Tools'</span>));</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)"><span style="color:rgb(0,0,0)">addpath(</span>'~/Documents/fieldtrip'<span style="color:rgb(0,0,0)">);</span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)"><span style="color:rgb(0,0,0)">ft_defaults; </span>% add everything to path that we need</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45);min-height:12px"> </p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)"><span style="color:rgb(0,0,0)">addpath(</span>'~/Documents/fieldtrip/qsub'<span style="color:rgb(0,0,0)">);</span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)"><span style="color:rgb(0,0,0)">addpath(genpath(</span>'~/Documents/fieldtrip/template/'<span style="color:rgb(0,0,0)">)); </span><span style="color:rgb(37,153,45)">% neighbouring matfile</span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45);min-height:12px"> </p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)"><span style="color:rgb(4,51,255)">if</span><span style="color:rgb(0,0,0)"> strcmp(fname, </span><span style="color:rgb(178,69,243)">'B3a_clusterStatsERF.m'</span><span style="color:rgb(0,0,0)">) || strcmp(fname, </span><span style="color:rgb(178,69,243)">'B3b_clusterStatsTFR.m'</span><span style="color:rgb(0,0,0)">),</span><br></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)"><span style="color:rgb(0,0,0)">    addpath(</span><span style="color:rgb(178,69,243)">'~/Documents/fieldtrip/statfun/'</span><span style="color:rgb(0,0,0)">); </span>% need the combineClusters mex file</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)"><span style="color:rgb(0,0,0)">    addpath(</span>'~/Documents/fieldtrip/external/spm8/'<span style="color:rgb(0,0,0)">); </span><span style="color:rgb(37,153,45)">% for neighbour definition</span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)"><span style="color:rgb(0,0,0)">    </span>% <a href="http://mailman.science.ru.nl/pipermail/fieldtrip/2014-July/008238.html">http://mailman.science.ru.nl/pipermail/fieldtrip/2014-July/008238.html</a></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(4,51,255)">end</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(4,51,255);min-height:12px"> </p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">% options: compile verbose, only use the toolboxes we really need</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">% !!! runtime options should be preceded by - to work!</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">% dont need to activate the -nojvm flag, can still plot from executable</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)"><span style="color:rgb(4,51,255)">if</span><span style="color:rgb(0,0,0)"> strcmp(fname, </span>'B3a_clusterStatsERF.m'<span style="color:rgb(0,0,0)">) || strcmp(fname, </span>'B3b_clusterStatsTFR.m'<span style="color:rgb(0,0,0)">),</span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;min-height:12px">    </p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)"><span style="color:rgb(0,0,0)">    </span>% statfun is called with a weird eval construction, so not recognized</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)"><span style="color:rgb(0,0,0)">    </span>% by the dependency analysis of mcc</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)"><span style="color:rgb(0,0,0)">    mcc(</span>'-mv'<span style="color:rgb(0,0,0)">, </span>'-N'<span style="color:rgb(0,0,0)">, </span>'-p'<span style="color:rgb(0,0,0)">, </span>'stats'<span style="color:rgb(0,0,0)">, </span>'-p'<span style="color:rgb(0,0,0)">, </span>'images'<span style="color:rgb(0,0,0)">, </span>'-p'<span style="color:rgb(0,0,0)">, </span>'signal'<span style="color:rgb(0,0,0)">, </span><span style="color:rgb(4,51,255)">...</span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)"><span style="color:rgb(0,0,0)">        </span>'-R'<span style="color:rgb(0,0,0)">, </span>'-nodisplay'<span style="color:rgb(0,0,0)">, </span>'-R'<span style="color:rgb(0,0,0)">, </span>'-singleCompThread'<span style="color:rgb(0,0,0)">, </span><span style="color:rgb(4,51,255)">...</span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)"><span style="color:rgb(0,0,0)">        </span>'-a'<span style="color:rgb(0,0,0)">, </span>'~/Documents/fieldtrip/ft_statistics_montecarlo.m'<span style="color:rgb(0,0,0)">, </span><span style="color:rgb(4,51,255)">...</span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)"><span style="color:rgb(0,0,0)">        </span>'-a'<span style="color:rgb(0,0,0)">, </span>'~/Documents/fieldtrip/statfun/ft_statfun_depsamplesT.m'<span style="color:rgb(0,0,0)">, </span><span style="color:rgb(4,51,255)">...</span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">        fname);</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(4,51,255)">else</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)"><span style="color:rgb(0,0,0)">    </span>% no need to specify additional files</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)"><span style="color:rgb(0,0,0)">    mcc(</span>'-mv'<span style="color:rgb(0,0,0)">, </span>'-N'<span style="color:rgb(0,0,0)">, </span>'-p'<span style="color:rgb(0,0,0)">, </span>'stats'<span style="color:rgb(0,0,0)">, </span>'-p'<span style="color:rgb(0,0,0)">, </span>'images'<span style="color:rgb(0,0,0)">, </span>'-p'<span style="color:rgb(0,0,0)">, </span>'signal'<span style="color:rgb(0,0,0)">, </span><span style="color:rgb(4,51,255)">...</span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)"><span style="color:rgb(0,0,0)">        </span>'-R'<span style="color:rgb(0,0,0)">, </span>'-nodisplay'<span style="color:rgb(0,0,0)">, </span>'-R'<span style="color:rgb(0,0,0)">, </span>'-singleCompThread'<span style="color:rgb(0,0,0)">, </span><span style="color:rgb(4,51,255)">...</span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">        fname);</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(4,51,255)">end</p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Courier;min-height:14px"><br></p><p style="margin:0px;font-size:12px;line-height:normal;font-family:Courier;min-height:14px"><span style="font-family:arial,sans-serif;font-size:small">So, the trick is to add everything to your path before comping, and then use the -N option and define specific folders and possible functions using -a. Make sure to only include additional subfolders from Fieldtrip (such as the templates folder) only if you need them, for including them will increase the size of the executable considerably. Also, some functions like the ft_statistics ones are not directly called but instead evaluated using </span><span style="font-family:arial,sans-serif;font-size:small">statmethod = str2func(['ft_statistics_' cfg.method]) - this causes the dependency analysis of the compiler to skip those functions, so you'll have to add them manually.</span><br></p><p style="margin:0px;font-size:12px;line-height:normal;font-family:Courier;min-height:14px"><span style="font-family:arial,sans-serif;font-size:small"><br></span></p><p style="margin:0px;font-size:12px;line-height:normal;font-family:Courier;min-height:14px"><span style="font-family:arial,sans-serif;font-size:small">PS a similar setup should work directly from the command line mcc, but I found it easier to run ft_defaults from Matlab and then compile from within a Matlab script.</span></p><p style="margin:0px;font-size:12px;line-height:normal;font-family:Courier;min-height:14px"><span style="font-family:arial,sans-serif;font-size:small"><br></span></p><p style="margin:0px;font-size:12px;line-height:normal;font-family:Courier;min-height:14px"><span style="font-family:arial,sans-serif;font-size:small">Hope this helps!</span></p><p style="margin:0px;font-size:12px;line-height:normal;font-family:Courier;min-height:14px"><span style="font-family:arial,sans-serif;font-size:small"><br></span></p><div style="color:rgb(0,0,0);font-family:helvetica,arial;font-size:13px">— </div><div style="color:rgb(0,0,0);font-family:helvetica,arial;font-size:13px"><span style="font-family:'helvetica Neue',helvetica">Anne E. Urai, MSc</span></div><div style="color:rgb(0,0,0);font-family:helvetica,arial;font-size:13px"><span style="font-family:'helvetica Neue',helvetica">PhD student | Institut für Neurophysiologie und Pathophysiologie </span></div><div style="color:rgb(0,0,0);font-family:helvetica,arial;font-size:13px"><span style="font-family:'helvetica Neue',helvetica">Universitätsklinikum Hamburg-Eppendorf | </span><span style="font-family:'helvetica Neue',helvetica">Martinistrasse 52, 20246 | Hamburg, Germany </span></div><div style="color:rgb(0,0,0);font-family:helvetica,arial;font-size:13px"><span style="font-family:'helvetica Neue',helvetica"><a href="http://www.anneurai.net/">www.anneurai.net</a> / </span><a href="https://twitter.com/AnneEUrai"><span style="font-family:'helvetica Neue',helvetica">@AnneEUrai</span></a></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 10 June 2016 at 10:42, Jose <span dir="ltr"><<a href="mailto:joseluisblues@gmail.com" target="_blank">joseluisblues@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>dear list,<br>
<br>
I'm trying to analyse <span>CTF</span> MEG data through the Flemish Supercomputer Centre,<br>I did a matlab script to run the foremost FT functions in my pipeline (ft_read_event, read_ctf_cls, and ft_preprocessing). This script works well when I run it locally. To compile my function in the supercomputing cluster I initially used addpath to include FT and ft_defaults to set the configuration inside my script, but this wasn't working. I tried using a startup.m script but this doesn't work neither. Maybe I'm missing something? My bash script to compile looks like this:<br><br>#!/bin/bash<br>module load MATLAB/2013b<br>FTDIR=$VSC_DATA_VO_USER/fieldtrip-20160317<br>mcc -mv FT_0.m<br><br>I also tried mcc -mv FT_0.m -I $FTDIR<br>I run my compilation in the same folder where I have the FT folder.<br>When I run my bash job I get always the same error: Undefined function 'ft_read_event' for input arguments of type 'char'.<br><br></div>I've been looking elsewhere but still I haven't find a solution,<br><div><br>Any hints about this would really appreciated,<br>best,<br>Jose<br></div></div>
<br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div>