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.
  1 件のコメント
Abimbola Oyeyi
Abimbola Oyeyi 2021 年 12 月 16 日
Thank you very much. you were right, I was using columns beyond by defined strain value.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStress and Strain についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by