필터 지우기
필터 지우기

assigning text from values

조회 수: 2 (최근 30일)
Bernard
Bernard 2014년 1월 3일
편집: Andrei Bobrov 2014년 1월 3일
Hello, what is the easiest way to assign a name(kind of like a categorical title) to a value, in a set of values. say 0 = yes, 1 = no, 2 =maybe, 3 = abstain, and I have a vector of the values e.g. X = [0,2,3,2,1,3,2,1,0]. I want to be able to then have a corresponding text vector and then if possible concatenate them so that the text appears in column next to value

채택된 답변

Andrei Bobrov
Andrei Bobrov 2014년 1월 3일
편집: Andrei Bobrov 2014년 1월 3일
t = {'yes', 'no', 'maybe', 'abstain'};
X = [0,2,3,2,1,3,2,1,0];
out = [num2cell(X);t(X+1)];

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by