Index in position 1 exceeds array bounds (must not exceed 20598)
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello,
I am using Matlab to make a Data Transformation and Analysis Project, and, honesty, I don't know that much about Matlab and can't seem to find the answer to this problem. I have tried a lot of stuff and can't seem to fix it.
The problem is on the second line of case 2. But even if I comment it, it will happen again in line 5 of case 2.
Obviously, there is a lot of code before this. If you want, I can provide it, just don't know if it is needed.
Thanks in advance!
for i=1:size(ix_labels,1) %For do número dos ID's experimentais iguais
switch all_labels((ix_labels(i,1)),3) %Switch do ID da atividade
case 1
ativid_unica = W_X{n};
ativid_unica{size(ativid_unica,2)+1} = data(all_labels(ix_labels(i,1),4):all_labels(ix_labels(i,1),5),1);
W_X{n} = ativid_unica;
ativid_unica = W_Y{n};
ativid_unica{size(ativid_unica,2)+1} = data(all_labels(ix_labels(i,1),4):all_labels(ix_labels(i,1),5),2);
W_Y{n} = ativid_unica;
ativid_unica = W_Z{n};
ativid_unica{size(ativid_unica,2)+1} = data(all_labels(ix_labels(i,1),4):all_labels(ix_labels(i,1),5),3);
W_Z{n} = ativid_unica;
case 2
ativid_unica = W_Up_X{n};
ativid_unica{size(ativid_unica,2)+1} = data(all_labels(ix_labels(i,1),4):all_labels(ix_labels(i,1),5),1);
W_Up_X{n} = ativid_unica;
ativid_unica = W_Up_Y{n};
ativid_unica{size(ativid_unica,2)+1} = data(all_labels(ix_labels(i,1),4):all_labels(ix_labels(i,1),5),2);
W_Up_Y{n} = ativid_unica;
ativid_unica = W_Up_Z{n};
ativid_unica{size(ativid_unica,2)+1} = data(all_labels(ix_labels(i,1),4):all_labels(ix_labels(i,1),5),3);
W_Up_Z{n} = ativid_unica;
case 3
ativid_unica = W_Down_X{n};
ativid_unica{size(ativid_unica,2)+1} = data(all_labels(ix_labels(i,1),4):all_labels(ix_labels(i,1),5),1);
W_Down_X{n} = ativid_unica;
ativid_unica = W_Down_Y{n};
ativid_unica{size(ativid_unica,2)+1} = data(all_labels(ix_labels(i,1),4):all_labels(ix_labels(i,1),5),2);
W_Down_Y{n} = ativid_unica;
댓글 수: 1
DGM
2021년 5월 17일
편집: DGM
2021년 5월 17일
The error is pretty straightforward. You're trying to access the 20598th element of an array. That array has fewer than 20598 elements. Is it supposed to?
What are the sizes of all the W_xxx_X, W_xxx_Y, etc cell arrays? What is n? What is the relationship of the product of that geometry to n? How is n calculated?
답변 (1개)
Kiran Felix Robert
2021년 6월 24일
Hi,
Refer the following answer for a clear explanation to the error.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!