Why do I get the "index exceeds matrix dimensions error"?
Show older comments
Hello, I really need some help with the code below. I am trying to take a random row from EVLP and add the values to sequential rows in DLP. I thought I had it but I keep getting the error index exceeds matrix dimensions. I hope that makes sense and someone can help.
EVLP = table2array(EVLoadprofilestop10); DLP = table2array(Domesticloadprofiles);
for i = 1:length(EVLP)
ind = randi(size(EVLP,1));
row = EVLP(ind,:);
DLP = DLP(i,:) + row;
i+1;
end1 Comment
Walter Roberson
on 19 Apr 2018
i+1;
calculates i+1 and then discards the value. It is not doing anything useful in your code, but it is also not hurting other than the confusion it is causing.
Note: do not do i=i+1; at that point. Your for loop is taking care of incrementing i.
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!