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

조회 수: 1 (최근 30일)
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

채택된 답변

Adam Danz
Adam Danz 2021년 12월 16일
편집: Adam Danz 2021년 12월 16일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Stress and Strain에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by