Extensions/MatlabBridge: Send transform (4x4 matrix) from Matlab to 3D Slicer

Thank you for your suggestions!

I was creating a new Module in Slicer, which worked (called ‘Matrix1’)
I was saving the needed Matrix in a mat file (‘matrixfilteredvolume.mat’) and I was loadinng it into the .m file from Matrix1 module. Then I was saving the mat file (FilteredVolume matrix) under a new variable called ‘Matrix’. I was changing the XML file like this:

<?xml version="1.0" encoding="utf-8"?>
<executable>
  <category>Matlab</category>
  <title>Matrix1</title>
  <description><![CDATA[Perform a simple image processing and image statistics computation in Matlab.]]></description>
  <version>0.0.0.1</version>
  <documentation-url>http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Extensions/MatlabBridge</documentation-url>
  <license/>
  <contributor>Andras Lasso (PerkLab)</contributor>
  <acknowledgements><![CDATA[SparKit is a project funded by Cancer Care Ontarioand the Ontario Consortium for Adaptive Interventions in Radiation Oncology (OCAIRO) to provide free, open-source toolset for radiotherapy and related image-guided interventions.]]></acknowledgements>
  <parameters>
    <label>Processing Parameters</label>
    <description><![CDATA[Parameters for the processing]]></description>
    <integer>
      <label>Threshold</label>
      <description><![CDATA[All voxels below this value will be set to zero]]></description>
      <longflag>threshold</longflag>
      <default>50</default>
      <constraints>
        <minimum>-2000</minimum>
        <maximum>5000</maximum>
        <step>5</step>
      </constraints>      
    </integer>
  </parameters>
  <parameters>
    <label>IO</label>
    <description><![CDATA[Input/output parameters]]></description>
    <image>
      <label>Matrix</label>
      <description><![CDATA[Input volume to be filtered]]></description>
      <longflag>inputvolume</longflag>
      <channel>input</channel>
    </image>
    <image>
      <label>Matrix</label>
      <description><![CDATA[Output filtered]]></description>
      <longflag>outputvolume</longflag>
      <channel>output</channel>
    </image>
  </parameters>
  <parameters>
    <label>Output</label>
    <description>Matlab command output</description>
    <double>
      <label>Minimum</label>
      <description><![CDATA[Image mininum]]></description>
      <name>min</name>
      <channel>output</channel>
      <default></default>
    </double>    
    <double>
      <label>Maximum</label>
      <description><![CDATA[Image maximum]]></description>
      <name>max</name>
      <channel>output</channel>
      <default></default>
    </double>    
  </parameters>
</executable>

and where running the code of the .m file through the new Slicer module:

function outputParams=Matrix1(inputParams)

load 'matrixfilteredvolume.mat'

Matrix = FilteredVolume

img=cli_imageread(inputParams.'Matrix');

outputParams.min=min(min(min(img.pixelData)));
outputParams.max=max(max(max(img.pixelData)));

img.pixelData=(double(img.pixelData)>inputParams.threshold)*100;

cli_imagewrite(inputParams.'Matrix', img);

The following Error appeared:
Matrix1 standard error:

Failed to execute Matlab function: Matrix1, received the following error message:
ERROR: Command execution failed. Error: File: Matrix1.m Line: 16 Column: 32
Unexpected MATLAB expression.

Error in cli_commandserver (line 91)
response=evalc(cmd);

Error in run (line 91)
evalin(‘caller’, strcat(script, ‘;’));


Did I load the matrix in a wrong way?