For Error: ??? Index exceeds matrix dimensions.
1 view (last 30 days)
Show older comments
Dear Sir,
This part of my code...I don't know why I have this error "??? Index exceeds matrix dimensions"...
T =[];
for j = 41:41:492
S1Secondcell1 = x1Firstrow16 (j+1: j+j, :);
X1= S1Secondcell1 (:,1);
Y1 = S1Secondcell1(:,2);
p1 = polyfit(X1,Y1,20)
T = [T; p1];
end
0 Comments
Answers (3)
per isakson
on 6 Apr 2014
Edited: per isakson
on 6 Apr 2014
You don't supply enough information to make it possible for us to find the cause of the error.
Here are some links on debugging in Matlab
Hint: what does
size( x1Firstrow16 )
return?
0 Comments
Roger Stafford
on 6 Apr 2014
Edited: Roger Stafford
on 6 Apr 2014
I rather think your trouble is caused by the way you indexed the array 'x1Firstrow16'. Its rows are successively indexed as:
41:82
83:164
123:246
165:328
.......
493:984
These are overlapping each other more and more as j increases. Somehow I doubt if that is what you meant to do, and I doubt that the array has 984 rows. You can check that easily with the 'size' command.
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!