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];

回答 (2 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 11 月 15 日
編集済み: Azzi Abdelmalek 2013 年 11 月 15 日

0 投票

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 2013 年 11 月 15 日

0 投票

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.

この質問は閉じられています。

質問済み:

2013 年 11 月 15 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by