Not enough input arguments.

Hi everyone,
I am trying to use Matlab to transform MNI coordinates in to Talaraich coordinates using the following function (found here: http://imaging.mrc-cbu.cam.ac.uk/imaging/MniTalairach#Approach_1:_redo_the_affine_transform):
function outpoint = aff_mni2tal(inpoint)
Tfrm = [0.88 0 0 -0.8;0 0.97 0 -3.32; 0 0.05 0.88 -0.44;0 0 0 1];
tmp = Tfrm * [inpoint 1];
outpoint = tmp(1:3);
I have saved the function and added it to the file path. The problem arises when I try and enter MNI coordinates:
aff_mni2tal( [10 12 14] )
I get the following error message:
Error using * Inner matrix dimensions must agree. Error in aff_mni2tal (line 3) tmp = Tfrm * [inpoint 1];

Answers (2)

Azzi Abdelmalek
Azzi Abdelmalek on 15 Nov 2013
Edited: Azzi Abdelmalek on 15 Nov 2013
You have to use multiplication element by element .* instead of *
function outpoint = aff_mni2tal(inpoint)
Tfrm = [0.88 0 0 -0.8;0 0.97 0 -3.32; 0 0.05 0.88 -0.44;0 0 0 1];
tmp = Tfrm .* [inpoint 1];
outpoint = tmp(1:3);
Image Analyst
Image Analyst on 15 Nov 2013
Tfrm is 4x4. [inpoint 1] is a by 4. You can't do a matrix multiplication of 4x4*1x4. Perhaps you meant to do a 4 by 1: [inpoint 1]'. The ' transposes the array.

This question is closed.

Asked:

on 15 Nov 2013

Closed:

on 20 Aug 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!