Convert numerical label Vector to char label
조회 수: 1 (최근 30일)
이전 댓글 표시
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
채택된 답변
Star Strider
2022년 6월 4일
편집: Star Strider
2022년 6월 4일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!