index exceeds matrix dimensions

13 vues (au cours des 30 derniers jours)
Christopher Manby
Christopher Manby le 23 Fév 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

Réponse acceptée

James Tursa
James Tursa le 23 Fév 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.
  1 commentaire
Christopher Manby
Christopher Manby le 25 Fév 2018
Solved it. Thank you very much for the advice. I won't forget this one!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by