Please why does this code give an error "Index in position 2 exceeds array bounds. Index must not exceed 6"

1 visualización (últimos 30 días)
Please why does this code give an error "Index in position 2 exceeds array bounds. Index must not exceed 6"
For line
plot (time, strain(:, [6,7]
figure(2)
sgtitle('Strain Comparison')
subplot(3,1,1);
plot(time, strain(:,[6,7]))
xtickformat('HH:mm:ss')
legend('Longitudinal','Transverse','Location','northwest')
xlabel('Time');
ylabel('Subbase Strain');
title('Control')
ylim([-800,200]); % put a '%' in front of it.
subplot(3,1,1);
plot(time,strain(:,[10,11]))
xtickformat('HH:mm:ss')
legend('Longitudinal','Transverse','Location','northwest')
xlabel('Time');
ylabel('Subbase Strain');
title('LCC400')
ylim([-200,200]); % put a '%' in front of it.
subplot(3,1,3);
plot(time,strain(:,[12,13]))
xtickformat('HH:mm:ss')
legend('Control','LCC400','Location','northwest')
xlabel('Time');
ylabel('Surface Strain');
title('Longitudinal Strain')
ylim([-300,200]); % put a '%' in front of it.Error

Respuesta aceptada

Adam Danz
Adam Danz el 16 de Dic. de 2021
Editada: Adam Danz el 16 de Dic. de 2021
According to the error, the variable "strain" only contains 6 columns but you're indexing a 7th column that doesn't exist. Either your column indices are incorrect or the "strain" variable is not the expected size.

Más respuestas (0)

Categorías

Más información sobre Stress and Strain en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by