index exceeds matrix dimensions

5 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

James Tursa
James Tursa il 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.
  1 Commento
Christopher Manby
Christopher Manby il 25 Feb 2018
Solved it. Thank you very much for the advice. I won't forget this one!

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by