フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

getting error "Index exceeds matrix dimensions"

1 回表示 (過去 30 日間)
Mirbahar Naadiya
Mirbahar Naadiya 2017 年 11 月 16 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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

回答 (1 件)

Star Strider
Star Strider 2017 年 11 月 16 日
Try this instead:
i=i+windowsize;
  2 件のコメント
Mirbahar Naadiya
Mirbahar Naadiya 2017 年 11 月 16 日
yeah thank u am not getting the error now but all the values of variable avgX is zero. Can u guide me to get mean of the data through sliding window
Star Strider
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!

Translated by