iscategory
입력값이 범주의 이름인지 확인
설명
예제
이름이 범주인지 확인하기
categorical
형 배열인 A
를 만듭니다.
A = categorical(["shirt","pants"; "pants","hat"; "shirt","pants"])
A = 3x2 categorical
shirt pants
pants hat
shirt pants
A
의 범주가 의류 품목의 이름입니다. 의류 품목은 입력 배열의 고유한 값에서 가져옵니다.
categories(A)
ans = 3x1 cell
{'hat' }
{'pants'}
{'shirt'}
의류 품목의 이름인 shirt
, pants
, socks
, shoes
가 A
의 범주인지 확인합니다.
catnames = ["shirt","pants","socks","shoes"]
catnames = 1x4 string
"shirt" "pants" "socks" "shoes"
tf = iscategory(A,catnames)
tf = 1x4 logical array
1 1 0 0
shirt
와 pants
는 A
의 범주이지만, socks
와 shoes
는 A의 범주가 아닙니다.
iscategory
는 catnames
에 포함하지 않은 범주 hat
에 대해서는 어떠한 정보도 제공하지 않습니다.
대응하는 데이터가 없는 범주인지 테스트
categorical
형 배열인 A
를 만듭니다.
data = ["plane","car","train","car","plane"]; categoriesOfData = ["boat","car","plane","train"]; A = categorical(data,categoriesOfData)
A = 1x5 categorical
plane car train car plane
boat
가 A
의 범주인지 확인합니다.
tf = iscategory(A,"boat")
tf = logical
1
A
에 범주 boat
의 값이 포함되어 있지 않아도 iscategory
는 1
(true)을 반환합니다.
패턴을 사용하여 범주 이름 일치시키기
categorical
형 배열을 만듭니다.
C = categorical(["Y" "Yes" "Yeah" "N" "No" "Nope"])
C = 1x6 categorical
Y Yes Yeah N No Nope
pattern
을 사용하여 하나 이상의 범주 이름을 일치시킬 수 있습니다. 예를 들어 와일드카드 패턴을 사용하여 범주 이름이 Y
로 시작하는지 확인합니다. wildcardPattern
함수를 사용하여 와일드카드 패턴을 만들 수 있습니다.
tf = iscategory(C,"Y" + wildcardPattern)
tf = logical
1
범주 이름이 X
로 시작하는지 확인합니다.
tf = iscategory(C,"X" + wildcardPattern)
tf = logical
0
입력 인수
확장 기능
tall형 배열
메모리에 담을 수 없을 정도로 많은 행을 가진 배열을 계산할 수 있습니다.
C/C++ 코드 생성
MATLAB® Coder™를 사용하여 C 코드나 C++ 코드를 생성할 수 있습니다.
사용법 관련 참고 및 제한 사항:
catnames
입력 인수는 패턴 표현식을 지원하지 않습니다.
자세한 내용은 Code Generation for Categorical Arrays (MATLAB Coder) 항목을 참조하십시오.
스레드 기반 환경
MATLAB®의 backgroundPool
을 사용해 백그라운드에서 코드를 실행하거나 Parallel Computing Toolbox™의 ThreadPool
을 사용해 코드 실행 속도를 높일 수 있습니다.
이 함수는 스레드 기반 환경을 완전히 지원합니다. 자세한 내용은 스레드 기반 환경에서 MATLAB 함수 실행하기 항목을 참조하십시오.
분산 배열
Parallel Computing Toolbox™를 사용하여 대규모 배열을 클러스터의 결합된 메모리에 걸쳐 분할할 수 있습니다.
이 함수는 분산 배열을 완전히 지원합니다. 자세한 내용은 분산 배열을 사용하여 MATLAB 함수 실행 (Parallel Computing Toolbox) 항목을 참조하십시오.
버전 내역
R2013b에 개발됨
참고 항목
categories
| categorical
| removecats
| mergecats
| renamecats
| reordercats
| ismember
| unique
| setcats
| addcats
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
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:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)