Convert numerical label Vector to char label
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
benghenia aek
am 4 Jun. 2022
Bearbeitet: Star Strider
am 4 Jun. 2022
Hello,I want to convert a to b please a=[1 1 2 1 3 1 3 2] To b=[as as be as ce as ce be].
0 Kommentare
Akzeptierte Antwort
Star Strider
am 4 Jun. 2022
Bearbeitet: Star Strider
am 4 Jun. 2022
Try this —
map = {'as','be','ce'}; % Cell Array
a=[1 1 2 1 3 1 3 2];
b = map(a)
b = strtrim(sprintf(' %s ',b{:}))
% To b=[as as be as ce as ce be].
map = ["as","be","ce"]; % String Array
a=[1 1 2 1 3 1 3 2];
b = map(a)
b = strtrim(sprintf(' %s ',b))
EDIT — (4 Jun 2022 at 2:48)
.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Characters and Strings 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!