removevars
테이블 또는 타임테이블에서 변수 삭제
설명
예제
변수 제거하기
테이블을 만든 다음 변수를 한 번에 하나씩 제거합니다. 테이블에서 이름 또는 위치로 변수를 지정할 수 있습니다.
스프레드시트 데이터를 테이블로 읽어 들입니다. 처음 세 개의 행을 표시합니다.
T1 = readtable('outages.csv');
head(T1,3)
Region OutageTime Loss Customers RestorationTime Cause _____________ ____________________ ______ __________ ____________________ ________________ {'SouthWest'} 01-Feb-2002 12:18:00 458.98 1.8202e+06 07-Feb-2002 16:50:00 {'winter storm'} {'SouthEast'} 23-Jan-2003 00:49:00 530.14 2.1204e+05 NaT {'winter storm'} {'SouthEast'} 07-Feb-2003 21:15:00 289.4 1.4294e+05 17-Feb-2003 08:14:00 {'winter storm'}
Region
이라는 변수를 제거합니다.
T2 = removevars(T1,'Region');
head(T2,3)
OutageTime Loss Customers RestorationTime Cause ____________________ ______ __________ ____________________ ________________ 01-Feb-2002 12:18:00 458.98 1.8202e+06 07-Feb-2002 16:50:00 {'winter storm'} 23-Jan-2003 00:49:00 530.14 2.1204e+05 NaT {'winter storm'} 07-Feb-2003 21:15:00 289.4 1.4294e+05 17-Feb-2003 08:14:00 {'winter storm'}
T2
에서 네 번째 변수를 제거합니다.
T3 = removevars(T2,4); head(T3,3)
OutageTime Loss Customers Cause ____________________ ______ __________ ________________ 01-Feb-2002 12:18:00 458.98 1.8202e+06 {'winter storm'} 23-Jan-2003 00:49:00 530.14 2.1204e+05 {'winter storm'} 07-Feb-2003 21:15:00 289.4 1.4294e+05 {'winter storm'}
여러 개의 변수 지정하기
removevars
함수를 사용하여 여러 개의 테이블 변수를 제거합니다. 이름 또는 위치로 변수를 지정할 수 있습니다.
스프레드시트 데이터를 테이블로 읽어 들입니다.
T1 = readtable('outages.csv');
head(T1,3)
Region OutageTime Loss Customers RestorationTime Cause _____________ ____________________ ______ __________ ____________________ ________________ {'SouthWest'} 01-Feb-2002 12:18:00 458.98 1.8202e+06 07-Feb-2002 16:50:00 {'winter storm'} {'SouthEast'} 23-Jan-2003 00:49:00 530.14 2.1204e+05 NaT {'winter storm'} {'SouthEast'} 07-Feb-2003 21:15:00 289.4 1.4294e+05 17-Feb-2003 08:14:00 {'winter storm'}
Loss
및 Customers
라는 변수를 제거합니다. 문자형 벡터로 구성된 셀형 배열을 사용하여 이름을 지정합니다.
T2 = removevars(T1,{'Loss','Customers'}); head(T2,3)
Region OutageTime RestorationTime Cause _____________ ____________________ ____________________ ________________ {'SouthWest'} 01-Feb-2002 12:18:00 07-Feb-2002 16:50:00 {'winter storm'} {'SouthEast'} 23-Jan-2003 00:49:00 NaT {'winter storm'} {'SouthEast'} 07-Feb-2003 21:15:00 17-Feb-2003 08:14:00 {'winter storm'}
첫 번째 변수와 네 번째 변수를 제거합니다. 숫자형 배열을 사용하여 T2
에서 변수의 위치를 나타냅니다.
T3 = removevars(T2,[1 4]); head(T3,3)
OutageTime RestorationTime ____________________ ____________________ 01-Feb-2002 12:18:00 07-Feb-2002 16:50:00 23-Jan-2003 00:49:00 NaT 07-Feb-2003 21:15:00 17-Feb-2003 08:14:00
입력 인수
T1
— 입력 테이블
테이블 | 타임테이블
입력 테이블로, table형 또는 timetable형으로 지정됩니다.
vars
— 입력 테이블의 변수
string형 배열 | 문자형 벡터 | 문자형 벡터로 구성된 셀형 배열 | pattern
형 스칼라 | 숫자형 배열 | 논리형 배열
입력 테이블의 변수로, string형 배열, 문자형 벡터, 문자형 벡터로 구성된 셀형 배열, pattern
스칼라, 숫자형 배열 또는 논리형 배열로 지정됩니다.
예: T2 = removevars(T1,2)
는 두 번째 테이블 변수를 제거합니다.
예: T2 = removevars(T1,'Date')
는 Date
라는 테이블 변수를 제거합니다.
예: T2 = removevars(T1,{'Latitude','Longitude','Elevation'})
은 Latitude
, Longitude
및 Elevation
이라는 테이블 변수를 제거합니다.
확장 기능
tall형 배열
메모리에 담을 수 없을 정도로 많은 행을 가진 배열을 계산할 수 있습니다.
C/C++ 코드 생성
MATLAB® Coder™를 사용하여 C 코드나 C++ 코드를 생성할 수 있습니다.
사용법 관련 참고 및 제한 사항:
vars
입력 인수는 패턴 표현식을 지원하지 않습니다.
스레드 기반 환경
MATLAB®의 backgroundPool
을 사용해 백그라운드에서 코드를 실행하거나 Parallel Computing Toolbox™의 ThreadPool
을 사용해 코드 실행 속도를 높일 수 있습니다.
이 함수는 스레드 기반 환경을 완전히 지원합니다. 자세한 내용은 스레드 기반 환경에서 MATLAB 함수 실행하기 항목을 참조하십시오.
분산 배열
Parallel Computing Toolbox™를 사용하여 대규모 배열을 클러스터의 결합된 메모리에 걸쳐 분할할 수 있습니다.
이 함수는 분산 배열을 완전히 지원합니다. 자세한 내용은 분산 배열을 사용하여 MATLAB 함수 실행 (Parallel Computing Toolbox) 항목을 참조하십시오.
버전 내역
R2018a에 개발됨
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)