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

1 visualizzazione (ultimi 30 giorni)
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

Risposta accettata

Adam Danz
Adam Danz il 16 Dic 2021
Modificato: Adam Danz il 16 Dic 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.

Più risposte (0)

Categorie

Scopri di più su Stress and Strain in Help Center e File Exchange

Tag

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by