문서도움말 센터
이 페이지의 최신 내용은 아직 번역되지 않았습니다. 최신 내용은 영문으로 볼 수 있습니다.
범주를 categorical형 배열(Categorical Array)로 병합
B = mergecats(A,oldcats)
B = mergecats(A,oldcats,newcat)
예제
B = mergecats(A,oldcats)는 A에 있는 둘 이상의 범주를 첫 번째 범주 oldcats(1)로 병합합니다. A의 값 중 oldcats는 B에서 oldcats(1)이 됩니다.
A
oldcats
oldcats(1)
B
B = mergecats(A,oldcats,newcat)은 oldcats를 새로운 단일 범주 newcat으로 병합합니다. A의 값 중 oldcats는 B에서 newcat이 됩니다.
newcat
모두 축소
다양한 색을 포함하는 categorical형 배열을 만듭니다.
A = categorical({'red';'blue';'pink';'red';'blue';'red'})
A = 6x1 categorical red blue pink red blue red
A는 6x1 categorical형 배열입니다.
A의 범주를 표시합니다.
categories(A)
ans = 3x1 cell {'blue'} {'pink'} {'red' }
세 개의 범주가 사전순으로 되어 있습니다.
범주 red와 pink를 범주 red로 병합합니다. oldcats에서 먼저 red를 지정하여 병합된 범주로 사용합니다.
red
pink
oldcats = {'red','pink'}; B = mergecats(A,oldcats)
B = 6x1 categorical red blue red red blue red
mergecats는 A(3)의 값 pink를 red로 바꿉니다.
mergecats
A(3)
B의 범주를 표시합니다.
categories(B)
ans = 2x1 cell {'blue'} {'red' }
B에는 세 개가 아닌 두 개의 범주가 있습니다.
다양한 항목을 포함하는 categorical형 배열을 만듭니다.
A = categorical({'shirt' 'pants'; 'shoes' 'shirt'; 'dress' 'belt'})
A = 3x2 categorical shirt pants shoes shirt dress belt
ans = 5x1 cell {'belt' } {'dress'} {'pants'} {'shirt'} {'shoes'}
5개의 범주가 사전순으로 되어 있습니다.
범주 belt와 shoes를 새 범주 other로 병합합니다.
belt
shoes
other
B = mergecats(A,{'belt' 'shoes'},'other')
B = 3x2 categorical shirt pants other shirt dress other
belt와 shoes의 모든 인스턴스가 값 other로 바뀝니다.
ans = 4x1 cell {'other'} {'dress'} {'pants'} {'shirt'}
B에는 4개의 범주가 있으며, 그 순서는 더 이상 사전순이 아닙니다. other가 belt 자리에 표시됩니다.
순서형 categorical형 배열을 만듭니다.
A = categorical([1 2 3 2 1],1:3,{'poor','fair','good'},'Ordinal',true)
A = 1x5 categorical poor fair good fair poor
ans = 3x1 cell {'poor'} {'fair'} {'good'}
A가 순서형 배열이므로, 이 배열의 범주에는 수학적 정렬(Mathematical Ordering)인 poor < fair < good이 적용됩니다.
poor < fair < good
fair 또는 poor 값이 모두 bad가 된다고 가정하겠습니다. A는 순서형이므로 병합할 범주는 연속적이어야 합니다.
fair
poor
bad
B = mergecats(A,{'fair' 'poor'},'bad')
B = 1x5 categorical bad bad good bad bad
fair와 poor의 모든 인스턴스가 값 bad로 바뀝니다.
ans = 2x1 cell {'bad' } {'good'}
B에 두 개의 범주가 있으며, 이 범주는 다음과 같이 수학적 정렬로 나열되었습니다. bad < good.
bad < good
categorical형 배열로, 벡터, 행렬, 다차원 배열 중 하나로 지정됩니다.
병합할 범주로, 문자형 벡터로 구성된 셀형 배열 또는 string형 배열로 지정됩니다. A가 순서형인 경우 병합할 범주는 연속적이어야 합니다.
새 범주로, 문자형 벡터 또는 string형 스칼라로 지정됩니다.
이 함수는 tall형 배열을 완전히 지원합니다. 자세한 내용은 tall형 배열 항목을 참조하십시오.
이 함수는 분산 배열을 완전히 지원합니다. 자세한 내용은 Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox) 항목을 참조하십시오.
addcats | categories | iscategory | removecats | renamecats | reordercats | setcats
addcats
categories
iscategory
removecats
renamecats
reordercats
setcats
귀하의 시스템에 이 예제의 수정된 버전이 있습니다. 이 버전을 대신 여시겠습니까?
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office