Commit 44f9e330 authored by Michael Krause's avatar Michael Krause 🎉
Browse files

software: fieldtrip compilation and whitespace

parent 9e567738
......@@ -44,7 +44,7 @@ start in command line mode.
To get started, type one of these: helpwin, helpdesk, or demo.
For product information, visit www.mathworks.com.
>> _
>> _
In a job context you would just run :program:`matlab -r main` with main.m containing your script:
......@@ -79,7 +79,7 @@ over. A little like this maybe:
%
% subject_id: a string encoding the subject id
% sigma: a string encoding values for sigma
sigma = str2num(sigma);
repmat(cellstr(subject_id), 1, sigma)
......@@ -104,9 +104,9 @@ Example:
LD_LIBRARY_PATH is .:/opt/matlab/interactive/runtime/glnxa64:/opt/matlab/interactive/bin/glnxa64:/opt/matlab/interactive/sys/os/glnxa64:/opt/matlab/interactive/sys/java/jre/glnxa64/jre/lib/amd64/native_threads:/opt/matlab/interactive/sys/java/jre/glnxa64/jre/lib/amd64/server:/opt/matlab/interactive/sys/java/jre/glnxa64/jre/lib/amd64/client:/opt/matlab/interactive/sys/java/jre/glnxa64/jre/lib/amd64
Warning: No display specified. You will not be able to display graphics on the screen.
ans =
'42' '42' '42' '42' '42'
[krause@master ~]
......@@ -122,7 +122,7 @@ which in turn uses the function `normrnd()` from the statistics package:
[krause@master ~] cat matlab/tools/project/myrnd.m
function X = myrnd(arg)
X = normrnd(0, 1, arg, arg);
......@@ -148,14 +148,14 @@ version as MCR upon script invocation with :program:`run_project.sh`.
Setting up environment variables
---
LD_LIBRARY_PATH is .:/opt/matlab/R2014b/runtime/glnxa64:/opt/matlab/R2014b/bin/glnxa64:/opt/matlab/R2014b/sys/os/glnxa64:/opt/matlab/R2014b/sys/opengl/lib/glnxa64
ans =
0.5377 0.8622 -0.4336
1.8339 0.3188 0.3426
-2.2588 -1.3077 3.5784
[krause@master ~]
[krause@master ~]
.. note::
......@@ -183,13 +183,13 @@ Example: segmentation for a number of nifti images. The file batch.template cont
.. code-block:: bash
#!/bin/bash
i=0
for image in tp2/Old/*.nii ; do
fullpath=$PWD/$image
sed "s#%%IMAGE%%#$fullpath#" batch.template > batch_${i}.m
echo "run_spm12.sh /opt/matlab/interactive run $PWD/batch_${i}.m" | qsub -d.
i=$((i+1))
sed "s#%%IMAGE%%#$fullpath#" batch.template > batch_${i}.m
echo "run_spm12.sh /opt/matlab/interactive run $PWD/batch_${i}.m" | qsub -d.
i=$((i+1))
done
......@@ -201,17 +201,17 @@ toolboxes to SPM (e.g. cat12).
[krause@master ~] matlab
Warning: No display specified. You will not be able to display graphics on the screen.
< M A T L A B (R) >
Copyright 1984-2012 The MathWorks, Inc.
R2012a (7.14.0.739) 64-bit (glnxa64)
February 9, 2012
< M A T L A B (R) >
Copyright 1984-2012 The MathWorks, Inc.
R2012a (7.14.0.739) 64-bit (glnxa64)
February 9, 2012
To get started, type one of these: helpwin, helpdesk, or demo.
For product information, visit www.mathworks.com.
>> addpath(genpath('/home/mpib/krause/matlab/tools/spm12'))
>> spm_make_standalone()
[... lot's of output and warnings ...]
......@@ -226,6 +226,33 @@ This should create a folder :file:`spm_exec` below the spm toolbox location
containing the fresh :program:`spm12` and :program:`run_spm12.sh` which you can
then use in your jobs just like above.
Fieldtrip
---
To properly add the fieldtrip toolbox we have to jump through some more hoops.
For now the only reliable and flexible way is to run :program:`mcc()` from
within a Matlab session and make sure to run :program:`ft_defaults()` first.
Also, some of the provided mex files won't work out of the box, so we have to
recompile them using :program:`ft_compile_mex()`. This however stumbles over
some external C file called :file:`CalcMD5.c` using non-standard comments.
The following Matlab Script has been successfully used to create a compiled
script from a :file:`main.m` file, which relies on internal fieldtrip
functions.
.. code-block:: matlab
% setup path
basepath='/home/mpib/krause/matlab/tools/ConMemEEGTools/'
addpath([basepath, '/fieldtrip-20150930'])
ft_defaults()
% re-compile mex functions (this has to be done only once per fieldtrip version)
% "fix" the CalcMD5.c file
system(['sed -i ''s#//.*##g'' ', basepath, '/fieldtrip-20150930/external/fileexchange/CalcMD5.c'])
% and compile
ft_compile_mex(true)
% build the runtime environment
mcc('-m', 'main.m')
.. _`MATLAB Distributed Computing Server`: http://de.mathworks.com/help/mdce/index.html
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment