<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p><br>
</p>
<p>For the function version(runmatlab), in spyder, I got the result like this:</p>
<p><br>
</p>
<p></p>
<div>RuntimeError: Command:<br>
<b>matlab -nodesktop -nosplash -singleCompThread -r "addpath('/tmp/tmppHQYo8/runmatlab');pyscript;exit"</b><br>
Standard output:<br>
Warning: Unable to open display ':1'.  You will not be able to display graphics on the screen.<br>
Warning: No window system found.  Java option 'MWT' ignored<br>
<br>
                            < M A T L A B (R) ><br>
                  Copyright 1984-2010 The MathWorks, Inc.<br>
                Version 7.11.0.584 (R2010b) 64-bit (glnxa64)<br>
                              August 16, 2010<br>
<br>
 <br>
  To get started, type one of these: helpwin, helpdesk, or demo.<br>
  For product information, visit www.mathworks.com.<br>
 <br>
Executing pyscript at 29-Jun-2016 10:28:27:<br>
-------------------------------------------------------------------------------------<br>
MATLAB Version 7.11.0.584 (R2010b)<br>
MATLAB License Number: 295724<br>
Operating System: Linux 3.11.0-26-generic #45~precise1-Ubuntu SMP Tue Jul 15 04:02:35 UTC 2014 x86_64<br>
Java VM Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode<br>
-------------------------------------------------------------------------------------<br>
MATLAB                                                Version 7.11       (R2010b)<br>
Database Toolbox                                      Version 3.8        (R2010b)<br>
Image Processing Toolbox                              Version 7.1        (R2010b)<br>
MATLAB Compiler                                       Version 4.14       (R2010b)<br>
Neural Network Toolbox                                Version 7.0        (R2010b)<br>
Optimization Toolbox                                  Version 5.1        (R2010b)<br>
Parallel Computing Toolbox                            Version 5.0        (R2010b)<br>
Parallel Computing Toolbox                            Version 5.0        (R2010b)<br>
Signal Processing Toolbox                             Version 6.14       (R2010b)<br>
Statistical Parametric Mapping                        Version 5236       (SPM8)  <br>
Statistics Toolbox                                    Version 7.4        (R2010b)<br>
Wavelet Toolbox                                       Version 4.6        (R2010b)<br>
<br>
Standard error:<br>
/usr/cenir/matlabR2010b_64/bin/matlab: 1: /servernas/usr_cenir/matlabR2010b_64/bin/util/oscheck.sh: /lib64/libc.so.6: not found<br>
MATLAB code threw an exception:<br>
Undefined function or variable 'testhelloworld'.<br>
File:/tmp/tmppHQYo8/runmatlab/pyscript.m<br>
Name:pyscript<br>
Line:5<br>
<br>
Return code: 0<br>
Interface MatlabCommand failed to run. <br>
Interface Function failed to run. </div>
<p></p>
<p><br>
</p>
<p>the command line, actually, the addpath points to the wrong path, my matlab script is in :
<span style="font-size:12pt"><b>/aramis/home/wen/HAO_lab/testhelloworld.m</b></span></p>
<p><br>
</p>
<p>Actually, I think it is because I did not find the right documentation for nipype, cuz Im new to nipype...</p>
<p><br>
</p>
<p>Thanks, <br>
</p>
<p>Bonne journée<br>
</p>
<p><br>
</p>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>De :</b> Hao wen<br>
<b>Envoyé :</b> mercredi 29 juin 2016 10:25<br>
<b>À :</b> neuroimaging@python.org<br>
<b>Objet :</b> wrap a matlab script for Nipype</font>
<div> </div>
</div>
<div>
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p></p>
<p style="margin:0px 0px 10px; color:rgb(51,51,51); font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:13px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:18.5714302062988px; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; background-color:rgb(255,255,255)">
<span style="font-size:12pt">Hello:</span></p>
<p style="margin:0px 0px 10px; color:rgb(51,51,51); font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:13px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:18.5714302062988px; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; background-color:rgb(255,255,255)">
<span style="font-size:12pt">I am new to nipype, and recently, I want to wrap a matlab script for Nipype, but in your website, the example is not so specific,and I checked out all the posts that you have talked about, it is not so clear, whatever for the command
 line or to create the matlab interface by ourself, can you just make a good tutorial for us? in fact, the tutorial in the nipype website is not so well-structured, in my opinion...</span></p>
<p></p>
<p><span style="font-size:12pt">Specifically, here is my case I wanna wrap a matlab function with a nipype freesurfer node, my matlab function actually just got some jpg files and save it to the output directory, I followed some options from the tutorial and
 other posts:</span></p>
<p><br>
</p>
<p><span style="font-size:12pt">By the way, i am on Ubuntu 12.04</span><br>
</p>
<p><br>
</p>
<p></p>
<p style="margin:0px 0px 10px; color:rgb(51,51,51); font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:13px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:18.5714302062988px; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; background-color:rgb(255,255,255)">
<span style="font-size:12pt">def runmatlab():</span><br style="">
<span style="font-size:12pt">    from nipype.interfaces.matlab import MatlabCommand</span><br style="">
<span style="font-size:12pt">    mlab = MatlabCommand()</span><br style="">
<span style="font-size:12pt">    mlab.inputs.script = "/aramis/home/wen/HAO_lab/testhelloworld.m"</span><br style="">
<span style="font-size:12pt">    out = mlab.run()</span><br style="">
<span style="font-size:12pt">    out.outputs['matlab_output'] </span><br style="">
<span style="font-size:12pt">    print out.outputs.matlab_output</span><br style="">
<span style="font-size:12pt">    return out.outputs.matlab_output</span></p>
<p style="margin:0px 0px 10px; color:rgb(51,51,51); font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:13px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:18.5714302062988px; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; background-color:rgb(255,255,255)">
<span style="font-size:12pt">from nipype.interfaces.utility import Function</span><br style="">
<span style="font-size:12pt">import nipype.pipeline.engine as pe </span></p>
<p style="margin:0px 0px 10px; color:rgb(51,51,51); font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:13px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:18.5714302062988px; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; background-color:rgb(255,255,255)">
<span style="font-size:12pt">runmatlab = pe.Node(name='runmatlab',</span><br style="">
<span style="font-size:12pt">               interface=Function(input_names=[],</span><br style="">
<span style="font-size:12pt">                                  output_names=['out_file'],</span><br style="">
<span style="font-size:12pt">                                  function=runmatlab))</span></p>
<p style="margin:0px 0px 10px; color:rgb(51,51,51); font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:13px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:18.5714302062988px; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; background-color:rgb(255,255,255)">
<span style="font-size:12pt">runmatlab.run()</span></p>
<p style="margin:0px 0px 10px; color:rgb(51,51,51); font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:13px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:18.5714302062988px; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; background-color:rgb(255,255,255)">
<br>
</p>
<p style="margin:0px 0px 10px; color:rgb(51,51,51); font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:13px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:18.5714302062988px; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; background-color:rgb(255,255,255)">
</p>
<p style="margin:0px 0px 10px; color:rgb(51,51,51); font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:13px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:18.5714302062988px; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; background-color:rgb(255,255,255)">
<span style="font-size:12pt">the matlab file is just to print  'hello world'</span></p>
<p style="margin:0px 0px 10px; color:rgb(51,51,51); font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:13px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:18.5714302062988px; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; background-color:rgb(255,255,255)">
<span style="font-size:12pt"> </span></p>
<p style="margin:0px 0px 10px; color:rgb(51,51,51); font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:13px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:18.5714302062988px; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; background-color:rgb(255,255,255)">
<span style="font-size:12pt">I got this in the _report file :</span></p>
<p style="margin:0px 0px 10px; color:rgb(51,51,51); font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:13px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:18.5714302062988px; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; background-color:rgb(255,255,255)">
<span style="font-size:12pt">Node: utility</span><br style="">
<span style="font-size:12pt">=============</span></p>
<p style="margin:0px 0px 10px; color:rgb(51,51,51); font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:13px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:18.5714302062988px; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; background-color:rgb(255,255,255)">
<span style="font-size:12pt"> Hierarchy : runmatlab</span><br style="">
<span style="font-size:12pt"> Exec ID : runmatlab</span></p>
<p style="margin:0px 0px 10px; color:rgb(51,51,51); font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:13px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:18.5714302062988px; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; background-color:rgb(255,255,255)">
<span style="font-size:12pt">Original Inputs</span><br style="">
<span style="font-size:12pt">---------------</span></p>
<p style="margin:0px 0px 10px; color:rgb(51,51,51); font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:13px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:18.5714302062988px; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; background-color:rgb(255,255,255)">
<span style="font-size:12pt">* function_str : S'def runmatlab():\n    from nipype.interfaces.matlab import MatlabCommand\</span><br style="">
<span style="font-size:12pt">n    mlab = MatlabCommand()\n    mlab.inputs.script = "/aramis/home/wen/HAO_lab/testhellowor</span><br style="">
<span style="font-size:12pt">ld.m"\n    out = mlab.run()\n    out.outputs[\'matlab_output\'] \n    print out.outputs.matl</span><br style="">
<span style="font-size:12pt">ab_output\n    return out.outputs.matlab_output\n'</span><br style="">
<span style="font-size:12pt">.</span><br style="">
<span style="font-size:12pt">* ignore_exception : False</span></p>
<p style="margin:0px 0px 10px; color:rgb(51,51,51); font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:13px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:18.5714302062988px; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; background-color:rgb(255,255,255)">
<span style="font-size:12pt">in the runmatlab node, I got some files </span></p>
<span style="font-size:12pt">Also, I </span><span style="font-size:12pt">tr</span><span style="font-size:12pt">ied the tutorial example2 in nipype website :
</span><a id="LPlnk953969" href="http://nipy.org/nipype/devel/matlab_interface_devel.html" class="OWAAutoLink"><span style="font-size:12pt">http://nipy.org/nipype/devel/matlab_interface_devel.html</span></a><span style="font-size:12pt">, In my spyder, I got
 no display, but in my dir, I got the pyscript.m, I run it in my matlab, I got the result, does that mean that spyder cant find my matlab???? but I saw that in some post that you said the MatlabCommand will not use matlab engine, they just give some matlab
 script to it to run?</span><br>
<p></p>
<p style="margin:0px 0px 10px; color:rgb(51,51,51); font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:13px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:18.5714302062988px; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; background-color:rgb(255,255,255)">
<span style="font-size:12pt">Any advice will be appreciated:)</span></p>
<p style="margin:0px 0px 10px; color:rgb(51,51,51); font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:13px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:18.5714302062988px; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; background-color:rgb(255,255,255)">
<span style="font-size:12pt">Hao</span><br>
</p>
<div id="LPBorder_GT_14671885731140.21563213954114435" style="margin-bottom:20px; overflow:auto; width:100%; text-indent:0px">
<table id="LPContainer_14671885731090.7744170926352185" style="width:90%; background-color:rgb(255,255,255); overflow:auto; padding-top:20px; padding-bottom:20px; margin-top:20px; border-top:1px dotted rgb(200,200,200); border-bottom:1px dotted rgb(200,200,200)" cellspacing="0">
<tbody>
<tr style="border-spacing:0px" valign="top">
<td colspan="2" id="TextCell_14671885731110.2362593596041216" style="vertical-align: top; padding: 0px; display: table-cell; position: relative;">
<div id="LPRemovePreviewContainer_14671885731110.6579047385038963"></div>
<div id="LPTitle_14671885731110.02725487988531239" style="top:0px; color:rgb(0,120,215); font-weight:400; font-size:21px; font-family:"wf_segoe-ui_light","Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; line-height:21px">
<a target="_blank" href="http://nipy.org/nipype/devel/matlab_interface_devel.html" id="LPUrlAnchor_14671885731120.45454467271663757" style="text-decoration:none">Neuroimaging in Python - Pipelines and Interfaces — nipy ...</a></div>
<div id="LPMetadata_14671885731120.2842004164717479" style="margin:10px 0px 16px; color:rgb(102,102,102); font-weight:400; font-family:"wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size:14px; line-height:14px">
nipy.org</div>
<div id="LPDescription_14671885731130.748471661357743" style="display:block; color:rgb(102,102,102); font-weight:400; font-family:"wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size:14px; line-height:20px; max-height:100px; overflow:hidden">
How to wrap a MATLAB script¶ This is minimal script for wrapping MATLAB code. You should replace the MATLAB code template, and define approriate inputs and outputs.</div>
</td>
</tr>
</tbody>
</table>
</div>
<p></p>
<br>
<p></p>
<p><br>
</p>
</div>
</div>
</div>
</div>
</body>
</html>