Undefined function 'eq' for input arguments of type 'table'.
조회 수: 1 (최근 30일)
이전 댓글 표시
I have taken a random sample of 6000 out of a data set of 30000. I now want to remove this sample from my original dataset to conduct analysis on the now "new" 80% of the original. I am using the below code but getting the error above.
%%Randomly Select 6,000 observations (20%) without replacement
Test_data = datasample(Data,6000,'Replace',false);
TestData = array2table(Test_data);
Test_CustID = TestData(:,1);
sort1 = sortrows(Test_CustID,1);
for i = 1:6000;
Condition = sort1(i,1);
Sample = Data(:,1)==Condition;
Data(Sample,:)=[];
end
댓글 수: 0
답변 (1개)
Peter Perkins
2018년 3월 28일
Data(:,1) is an Nx1 table, and tables don't have math r relational operators defined on them. You need to compare the first variable in Data to condition. You could use Data{:,1}, but Data.Var1 would be much more readable. Actually, I have no idea what the first variable in your table is really called, substitute its real name for "Var1".
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!