Array indices must be positive integers or logical values

1 vue (au cours des 30 derniers jours)
Andrey Alexandrov
Andrey Alexandrov le 30 Août 2021
Commenté : Andrey Alexandrov le 30 Août 2021
Help me please. An error occurs when starting the program. How do I fix it?

Réponses (2)

Jan
Jan le 30 Août 2021
I looks like this is a script. Then is shares the workspace variables with its caller. I guess, that you have created an array called "real" anywhere. Then real(Io) does not call the function real(), but uses the values of Io as indices.
Check this by:
which real
Using function avoids such confusions, because you can check the local code, if a variable with such a name is created.
Avoid using names of builtin functions for variables.
  1 commentaire
Andrey Alexandrov
Andrey Alexandrov le 30 Août 2021
Jan, thank you very much for your comment. The program started

Connectez-vous pour commenter.


Wan Ji
Wan Ji le 30 Août 2021
You can do this by
Iout = double(Io)

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by