Error using Unique for table to remove duplicate rows which consists of mixed data types
Show older comments
Dear Experts,
I have a table with mixed data types. I try to remove duplicate rows according to column 1 (string) and column 2 (integer).
ie Inputs: Table X:
Ticker Date Price
AAPL 20160201 100
IBM 20160202 20.1
AAPL 20160202 90
AAPL 20160201 200
Desired output
Ticker Date Price
AAPL 20160201 200
AAPL 20160202 90
IBM 20160202 20.1
My code
[~,b] = unique(X(:,[1 2]), 'rows');
tmp = X(b,:);
but I have this error.
Error using cell/unique (line 85) Input A must be a cell array of strings.
Error in pre_process (line 12)
Thanks
Accepted Answer
More Answers (0)
Categories
Find more on Tables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!