How to use the min() and max() functions?
68 views (last 30 days)
Show older comments
I am trying to use min() and max() to find the minimum and maximum values of a vector (attached to this post if you would like to try)
According to the Mathworks website, using minVal = min(FHNout); and maxVal = max(FHNout); should work.
However, when trying these commands, I get the following error:
??? Subscript indices must either be real positive integers or logicals.
Why am I getting this error and how do I fix it?
Thanks for your help
0 Comments
Accepted Answer
John D'Errico
on 31 Mar 2018
Edited: John D'Errico
on 31 Mar 2018
If you want to use min or max, then don't name a variable with the name min, or max.
which min -all
which max -all
What does that tell you?
Never use variable names that conflict with a function name.
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!