MATLAB Answers


How to solve "Index exceeds matrix dimensions" error

Asked by J
on 4 May 2013


I am trying to crate a loop that plots 10000 points on a set of axis at a time from a matrix with 50 columns of 10000 data points each column by column. x is a linspace of 10000 points, submat was the creation of turning a vector of 500000 data points into a 50 column matrix using the submat command.

    for j=1:1:50
      v=submat (j*10000:(j+1)*10000,j:j); %extract rows in column j
      scatter (x,v,2);
      hold all;

This produces the error: "Index exceeds matrix dimensions."



No products are associated with this question.

1 Answer

Answer by the cyclist
on 4 May 2013

Your indexing is missing the first set of 10,000 and going beyond the end. I think you need


as your first index.


Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!