Undefined function 'eq' for input arguments of type 'table'.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Peter Perkins
am 28 Mär. 2018
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 Kommentare
Siehe auch
Kategorien
Mehr zu Tables finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!