Trouble with a for loop: Index exceeds the number of array elements (31)
Mostrar comentarios más antiguos
Hello, I am a beginner with matlab and am having trouble with a for loop. I want to create a vector by pulling data from a data set. The data set is divided into four columns (year, month, day, temperature). I want to take the temperature data for July from 1997 to 1999 and put it into a vector. This is what I have so far
for y = 1997:1999
save = temp(temp(:,1) == y & temp(:,2) == 7,4);
samp = save(y);
end
I keep getting this error Index exceeds the number of array elements (31). I understand what the error is telling me, but I do not know how to fix it. I attached the data set file.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!