Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

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

1 vue (au cours des 30 derniers jours)
Matt Brown
Matt Brown le 30 Juil 2015
Clôturé : MATLAB Answer Bot le 20 Août 2021
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 commentaires
Brendan Hamm
Brendan Hamm le 30 Juil 2015
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.

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by