Map an array yo another one
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have an array like: A=[3,5,6,10] and I need to map it to another one like: B=[1,2,3,4] so instead of returning A, I can return B. how can I do this?
2 Kommentare
Guillaume
am 15 Feb. 2018
The question is really not clear. What does map mean? How do you go from [3 5 6 10] to [1 2 3 4]? What is the rule?
Antworten (2)
Andrei Bobrov
am 15 Feb. 2018
Bearbeitet: Andrei Bobrov
am 15 Feb. 2018
A=[3,5,6,10];
B=[1,2,3,4];
C = randsrc(8,5,B);
ii = discretize(C,B);
out = A(ii);
Siehe auch
Kategorien
Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!