Info

此问题已关闭。 请重新打开它进行编辑或回答。

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

3 次查看(过去 30 天)
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