Index exceeds matrix dimensions
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I've got a problem and because of my bad knowledge of matlab, it would be great if someone know the solution for this problem.
arr = {'01', '02', '03', '04'};
ldir = '/data/.....'
cond= {Forstats_1PLhann.mat};
savedir = ldir;
for i= 1:11;
display (sprintf('analysing subject....%s,arr{i}));
subjectdir=strcat(ldir, 'Tsbj_', arr{i},'/');
load(strcat(subjectdir,cond {1}));
data{1,i} = ft_freqdescriptives ([], PLhann);
clear PLhann
end;
cond= {Forstats3_PLhann.mat'};
for i = 12:22
display (sprintf('analysing subject....%s,arr{i}));
subjectdir=strcat(ldir, 'Tsbj_', arr{i},'/');
load(strcat(subjectdir,cond {1}));
data{1,i} = ft_freqdescriptives ([], PLhann);
clear PLhann end;
ERROR: Index exceeds matrix dimensions
2 Kommentare
Antworten (1)
Ingrid
am 3 Apr. 2015
Bearbeitet: Ingrid
am 3 Apr. 2015
your array only contains four elements (first line of your code) in your loop you are trying to acces arr{i} where i goes from 1:11 this gives you the error message that the index exceeds matrix dimensions when the loop goes to i=5 because arr{5} does not exist so you have to change
for i = 1:4
OR define
arr = {'01', '02', '03', '04','05','06','07','08','09','10','11'};
depending on which one is applicable for your case
0 Kommentare
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!