Plot: index exceeds array bounds ("Index in position 1 exceeds array bounds. Index must not exceed 1.")

조회 수: 29 (최근 30일)
Greetings,
I have an array pexp.t (102x1, double) and an array pexp.pCO (102x3, double) which I would like to plot, but when I try plotting it using
plot(pexp.t,pexp.pCO(:,1))
I always get the error code
Index in position 1 exceeds array bounds. Index must not exceed 1.
I double checked if both arrays have the same / correct size in the Workspace aswell as using the command window (see below).
I can display both pexp.t and pexp.CO(:,1) just fine in the command window (see below), but as soon as I try plotting it, I get the aforementioned error code.
K>> pexp.t
ans =
2
4
6
8
10
12
14
K>> pexp.pCO(:,1)
ans =
1.0000
0.9873
0.9769
0.9694
0.9637
0.9590
0.9548
I am probably just missing something very obvious, but I can't seem to get it. Help is greatly appreciated.
Thank you kindly.

채택된 답변

Torsten
Torsten 대략 8시간 전
이동: Torsten 대략 8시간 전
Rename the struct "plot" which appears in your workspace. It's probably in conflict with MATLAB's "plot" function.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

제품


릴리스

R2025a

Community Treasure Hunt

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

Start Hunting!

Translated by