For some reason i exceed array bounds but i cant seem to figure out why.
The code looks like this:
1 for i = 1:length(rawData.sub3.epochs.run)
2 for j = 1:length(rawData.sub3.epochs.run{i}.movement)
3 k=ceil(j/4)
4 if rawData.sub3.label{i}.data(j,3) == 0
5 classData.sub3.movement.right{i,k}=rawData.sub3.epochs.run{i}.movement{j}
6 elseif rawData.sub3.label{i}.data(j,3) == 1
7 classData.sub3.movement.up{i,k}=rawData.sub3.epochs.run{i}.movement{j}
8 elseif rawData.sub3.label{i}.data(j,3) == 2
9 classData.sub3.movement.left{i,k}=rawData.sub3.epochs.run{i}.movement{j}
10 elseif rawData.sub3.label{i}.data(j,3) == 3
11 classData.sub3.movement.down{i,k}=rawData.sub3.epochs.run{i}.movement{j}
12 end
13 end
14 end
Where rawData is a struct that contains run(a 1x20 cell array) which each contain a 1x20 cell array (but in one case a 1x10).
The error i get is
"Error in code (line 4), if rawData.sub3.label{i}.data(j,3) == 0"
"Index in position 1 exceeds array bounds (must not exceed 10)."
but the code should in my eyes be able to handle the change in array size.
Furthermore the error seems to happen before it hits run{11} which is the 1x10 cell array.
any help would be appriciated.
댓글 수: 0
댓글을 달려면 로그인하십시오.