Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Why, Array indices must be positive integers or logical values

1 visualización (últimos 30 días)
Penuel Adiyiah
Penuel Adiyiah el 13 de Oct. de 2019
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
P=450000 r=0.042 M=P(r/12) Error array indices must be positive or logical values.
Can someone please help me Why is it saying this

Respuestas (1)

Star Strider
Star Strider el 13 de Oct. de 2019
It is saying that because ‘r’ is not an integer, and even if it was, there are only some instances in which ‘r/12’ would be an integer greater than 0.
Aside from that, ‘P’ is a scalar, so any subscript vallue other than 1 would not be valid.
However I suspect you are missing an multiplication operator, so that the assignment should be:
M = P.*(r/12)
since MATLAB does not recognise implicit multiplication.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by