"Pete " <firstname.lastname@example.org> wrote in message <email@example.com>... > Hi, > I am trying to use a For Loop to assign each individual number in a 31x1 matrix a letter. I have tried to create a For loop but i keep getting an error saying that it cannot label the point as there are not enough points in the matrix, i.e there are 31 numbers in the matrix and it is trying to find the 32nd. What am i doing wrong? Here is what i have at the moment: > > for j=1:length(Tr) > A=Tr(j); > B=Tr(j+1); > end > > Thanks
In the line B=Tr(j+1) you want to retrieve the "j+1"-th element of Tr. If j reached the value of length(Tr), Tr(j) is the last element, but there is no Tr(j+1) element anymore, of course. This is causing the error.