Info

この質問は閉じられています。 編集または回答するには再度開いてください。

'Subscript indices must either be real positive integers or logicals... and they are.' Why the error?

2 ビュー (過去 30 日間)
Matt Brown
Matt Brown 2015 年 7 月 30 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I keep getting the following error when I try to plot to vectors of data and it doesn't make sense to me. Does anyone know why this is happening?
x =
1.0e+04 *
3.592304700000000
3.631143000000000
3.684712000000000
3.722212000000000
3.767748400000000
3.833372000000000
3.886942000000000
3.935166400000000
4.007484799999999
4.075794999999999
>> y
y =
2.052695376905927
2.116785788400099
2.203573844584633
2.266329782184324
2.342437651581077
2.450590377072377
2.538714605463729
2.628180700403267
2.745678639284237
2.865853118409325
>> isreal(x)
ans =
1
>> isreal(y)
ans =
1
>> plot(x,y)
Subscript indices must either be real positive integers or logicals.
  2 件のコメント
Brendan Hamm
Brendan Hamm 2015 年 7 月 30 日
Likely, you have a variable named plot in the workspace, so MATLAB thinks you are trying to index into the variable and not call the plot function. Therefore the error is about an index and not a function input.

回答 (0 件)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by