Subscripted assignment dimension mismatch

clear all
cd('C:\Users\User\Desktop\smooth'),
listafile_rh=ls('C:\Users\User\Desktop\smooth');
qwe_rh=cellstr(listafile_rh)
ooo_rh=3
for uu_rh=1:4
fileathand_rh=qwe_rh(ooo_rh)
eval(['surface_rh{uu_rh}= spm_vol(''' cell2mat(fileathand_rh) ''');'])
outputsubject_rh(:,uu_rh)= spm_read_vols(surface_rh{uu_rh})
t= outputsubject_rh(:,uu_rh(:))
ooo_rh=ooo_rh+1
end
I get this error: Subscripted assignment dimension mismatch
Any Tips?

5 件のコメント

Geoff Hayes
Geoff Hayes 2016 年 12 月 6 日
Andrea - which line of code generates the error? Please copy and paste the full error message. Note that we don't have access to your file nor necessarily have the functions that you are using (spm_vol, spm_read_vols, etc.) so can't step through the code.
Also, try and avoid using eval There is usually an alternative to building commands dynamically...
Andrea Vatulas
Andrea Vatulas 2016 年 12 月 6 日
編集済み: Andrea Vatulas 2016 年 12 月 6 日
The error is just: Subscripted assignment dimension mismatch
Could you advice me an alternative to build my code and avoid this error?
Thanks in advice
Jan
Jan 2016 年 12 月 6 日
@Andrea: Do not just try to avoid eval but avoid it strictly. It causes much more troubles than it solves.
Geoff Hayes
Geoff Hayes 2016 年 12 月 6 日
Andrea - you will need to provide some context surrounding your code as it isn't clear how it is to be used (it doesn't help that the variable names are confusing). How are you using this code? Are you using Simulink? What is surface_rh?
Andrea Vatulas
Andrea Vatulas 2016 年 12 月 6 日
spm_vol is a function header information for magnetic resonance file (extension .nii) spm_read_vols is a function for reading entire volumes

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

質問済み:

2016 年 12 月 6 日

コメント済み:

2016 年 12 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by