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!