How to solve "Index exceeds matrix dimensions" error

Hello,
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;
end
This produces the error: "Index exceeds matrix dimensions."

답변 (1개)

the cyclist
the cyclist 2013년 5월 4일

0 개 추천

Your indexing is missing the first set of 10,000 and going beyond the end. I think you need
(j-1)*10000+1:j*10000
as your first index.

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

질문:

J
J
2013년 5월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by