Delete data in one table, based upon another table
Ältere Kommentare anzeigen
Hellooo,
So I have two tables in matlab which contain the exact same variables. The only difference is that one table contains more rows (participants) than the other, which is incorrect as these participants need to be removed.
So I'm trying to write a loop condition which takes the participant ID number (listed as a variable in the dataset) from the incorrect dataset, checks if this is listed in the correct dataset. Then if it's not present in the correct dataset, I want matlab to delete the whole row that the incorrect name appears on.
The output I want from this is two idential datasets with the same number of rows
this is the loop I've written so far:
But this code gives me the message: Operator '==' is not supported foroperands of type 'cell'.
Any help would be massively appreciated!
Thanks
Cam
for iFalsename = 1:nFalseNames
FalseNameNow = FalseNames2(iFalseName);
for iTrueName = 1:nTrueNames
TrueNameNow = TrueNames2(iTrueName); % Keep if TrueNameNow exist in FalseData
if eq(TrueNameNow, FalseNameNow)
% Insert code to remove column
end
end
end
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Tables finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!