index exceeds matrix dimensions
3 views (last 30 days)
Show older comments
Christopher Manby
on 23 Feb 2018
Commented: Christopher Manby
on 25 Feb 2018
I would appreciate if anyone could advise as to why I am receiving this error. note, x is a multiple of windowSize.
cheers Christy Burger
clear; clc; close all;
x = load('RotationSpeed.csv');
windowSize = 10;
b = (1/windowSize)*ones(1,windowSize);
ii = 1;
yTemp = 0;
for n = windowSize-1: length(x)
m = 0;
for j = 1 : windowSize
temp = b(j)*x(n-m);
yTemp = yTemp + temp;
m = m - 1;
n = n + 1;
end
y(ii,:) = [yTemp];
ii = ii+1;
yTemp = 0;
end
0 Comments
Accepted Answer
James Tursa
on 23 Feb 2018
Type the following at the command line:
dbstop if error
Then run your code. When the error occurs, the debugger will pause the code at the line of the error with all variables intact. Examine them for dimensions and for the indexing you are using on that line. Then figure out why the dimensions or indexing is not what you expected.
More Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!