mapminmax bug with zeroes?

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]?

답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

태그

질문:

2018년 4월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by