Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
getting error "Index exceeds matrix dimensions"
    조회 수: 4 (최근 30일)
  
       이전 댓글 표시
    
Can someone can help me to find out the error
 if true
    % code
i=1;
j=1;
windowsize=50;
[m,n]=size(accX);  
avgX=zeros(m,1);
%*******In each iteration, statistical values of a window are calculated
%and raw data(accX) index is inceremented by windowsize/2 to
%provide %50 overlapping*****%
while(i<=m)
     avgX(j)=mean(accX(i:i+windowsize-1));
     i=i+windowsize/2-1;
     j=j+1;
end
댓글 수: 0
답변 (1개)
  Star Strider
      
      
 2017년 11월 16일
        Try this instead:
i=i+windowsize;
댓글 수: 2
  Star Strider
      
      
 2017년 11월 16일
				That depends on what ‘accX’ is, and its size. Your code worked for me with a vector I created, and produced the three values I expected when ‘accX’ was a (150x1) vector.
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!