mapminmax bug with zeroes?
Show older comments
I am encountering a strange issue with mapminmax in R2017b (and previous versions), am I doing this correctly?
This should map the vector [0, 1, 2] to the range of -1 to +1
[a, b] = mapminmax([0, 1, 2], -1, 1);
As expected, a =
-1 0 1
Now if I try and use apply, this is what I get:
>> mapminmax('apply', 0, b)
ans =
0
>> mapminmax('apply', 2, b)
ans =
2
Essentially it fails at mapping the original vector [0, 1, 2]. Now if I make a small change to the vector such that it is [1, 2, 3], it works as expected.
>> [a, b] = mapminmax([1, 2, 3], -1, 1);
>> mapminmax('apply', 1, b)
ans =
-1
>> mapminmax('apply', 3, b)
ans =
1
What is going on? Why am I unable to use mapminmax with the original vector [0, 1, 2]?
Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!