Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
problem using filelist(i,:)=x; in a matlab code

Subject: problem using filelist(i,:)=x; in a matlab code

From: Nathan

Date: 5 Oct, 2010 18:43:04

Message: 1 of 3

I am trying to use matlab to run a statistical parametric mapping (SPM) script (art_global) but am having problems using the command filelist(i,:)=x;. Below is my script and the error message I receive.

%script%
X=dir('raf*.img'); X=char(X.name);
m=pwd;
for list = 1:size(X,1)
x=strcat(m,'/',X(list,:));
filelist(i,:)=x;
end

Y=dir('rp*.txt'); Y=char(Y.name);

spm_defaults;
art_global(filelist,Y,4,1);


%error message%
??? Subscript indices must either be real positive integers or logicals.

Error in ==> ArtRepair_Rishi at 8
filelist(i,:)=x;

Subject: problem using filelist(i,:)=x; in a matlab code

From: Sean

Date: 5 Oct, 2010 19:11:20

Message: 2 of 3

"Nathan " <nhutche@gmail.com> wrote in message <i8frjo$jlq$1@fred.mathworks.com>...
> I am trying to use matlab to run a statistical parametric mapping (SPM) script (art_global) but am having problems using the command filelist(i,:)=x;. Below is my script and the error message I receive.
>
> %script%
> X=dir('raf*.img'); X=char(X.name);
> m=pwd;
> for list = 1:size(X,1)
> x=strcat(m,'/',X(list,:));
> filelist(i,:)=x;
> end
>
> Y=dir('rp*.txt'); Y=char(Y.name);
>
> spm_defaults;
> art_global(filelist,Y,4,1);
>
>
> %error message%
> ??? Subscript indices must either be real positive integers or logicals.
>
> Error in ==> ArtRepair_Rishi at 8
> filelist(i,:)=x;

>>whos i
>>i
i is the square root of -1. How do you expect to store something in the sqrt(-1)th row of a matrix?

Subject: problem using filelist(i,:)=x; in a matlab code

From: Loren Shure

Date: 5 Oct, 2010 20:08:38

Message: 3 of 3


"Nathan " <nhutche@gmail.com> wrote in message
news:i8frjo$jlq$1@fred.mathworks.com...
> I am trying to use matlab to run a statistical parametric mapping (SPM)
> script (art_global) but am having problems using the command
> filelist(i,:)=x;. Below is my script and the error message I receive.
>
> %script% X=dir('raf*.img'); X=char(X.name);
> m=pwd;
> for list = 1:size(X,1)
> x=strcat(m,'/',X(list,:));
> filelist(i,:)=x;
> end
>
> Y=dir('rp*.txt'); Y=char(Y.name);
>
> spm_defaults;
> art_global(filelist,Y,4,1);
>
>
> %error message%
> ??? Subscript indices must either be real positive integers or logicals.
>
> Error in ==> ArtRepair_Rishi at 8
> filelist(i,:)=x;
>


the for loop index variable is list and not i

--
Loren
http://blogs.mathworks.com/loren/
http://matlabwiki.mathworks.com/MATLAB_FAQ

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us