Index exceeds number of array elements
Mostrar comentarios más antiguos
Hello,
Please excuse my naivety as a beginner with MATLAB but I am receiving an error message I'm struggling to get past. I am ultimately trying to plot a dataset.
for i=1:nVal
[fline,count] = fscanf (fid,'%f %f %f %f %f',5);
if (mod(i,20) == 1)
fprintf ('%6.1f %7.2f\n', fline(1), fline(2) ); % display the time and x value as a check
end
t(i) = fline(1); % load vector of time values
xm(i) = fline(2); % load vector of x readings
ym(i) = fline(3); % load vector of y readings
z1m(i) = fline(4); % load vector of z1 readings
z2m(i) = fline(5); % load vector of z2 readings
end
The error message that is coming up is:
Index exceeds the number of array elements. Index must not exceed 0.
Error in untitled (line 40)
fprintf ('%6.1f %7.2f\n', fline(1), fline(2) ); % display the time and x value as a check
There is of course more code before and after this and as a noobie, I wasn't sure how much would have been required to help solve this solution but this is the section that appears to be causing the error. Any help is much appreciated!
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Matrix Indexing 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!