remove variables except for prespecified variables from a table

조회 수: 10 (최근 30일)
alpedhuez
alpedhuez 2021년 8월 15일
댓글: alpedhuez 2021년 8월 15일
Suppose I have a table T with the set of variables
Date Location Visitors Purchases Item1 Item2 Item3 ...
I just want to keep variables
Date Visitors
and remove the rest of varibles. One can use removevars function but need to write down all variables that will be deleted. Is there any simpler way?

채택된 답변

Walter Roberson
Walter Roberson 2021년 8월 15일
newtable = T(:,{'Date', 'Visitors'});

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by