min() Subscript indices must either be real positive integers or logicals.

4 vues (au cours des 30 derniers jours)
Xiaoyan
Xiaoyan le 8 Juin 2016
Modifié(e) : Daniel Isaac le 19 Juil 2018
hi, whenever I try to use min() on a vector I get the error message: Subscript indices must either be real positive integers or logicals.
Below is an example
>> d
d =
3.4546 1.1588 4.6319 2.5456
>> min(d)
Subscript indices must either be real positive integers or logicals.
Please can sb help? Many thanks,

Réponses (1)

John D'Errico
John D'Errico le 8 Juin 2016
Modifié(e) : John D'Errico le 8 Juin 2016
Don't define a variable named min. If you do, then you get that exact error when you try to use the FUNCTION named min. IF you don't believe me, then try this:
which min -all
What does it tell you?
  3 commentaires
Stephen23
Stephen23 le 8 Juin 2016
Modifié(e) : Stephen23 le 8 Juin 2016
@Xiaoyan: we know what you want to do. Please run this command and tell us exactly what it prints:
which min -all
Daniel Isaac
Daniel Isaac le 19 Juil 2018
Modifié(e) : Daniel Isaac le 19 Juil 2018
Excuse me. And the solution is? Edit: Thank you! I understand! lol.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by