Filtering dates from matrix

1 vue (au cours des 30 derniers jours)
AA
AA le 23 Oct 2017
I have got a cell array with 'out' 1x1 which has a matrix with one million rows and 6colummns. First row contains date serial numbers. I want to filter out the rows that contain the date serial number found in the variable 'result'. Unfortunately, my following formula does not work. Is there any other way which is faster, i.e. Can I do the filtering directly in the matrix?
for x = 1:1 leon=ismember(out{x}(:,1),result); leonsum{x}=find(sum(leon,2)); out1{x}=out{x}(leonsum{x},1:6); end
Error:
Undefined function 'find' for input arguments of type 'cell'.

Réponse acceptée

Cam Salzberger
Cam Salzberger le 23 Oct 2017
Modifié(e) : Cam Salzberger le 23 Oct 2017
A 1x1 cell isn't much use to anyone, so it's probably easiest to just extract the matrix from inside:
outData = out{1};
Then you can use ismember on the first column of the data and "result" to determine which rows to remove:
whichToRemove = ismember(outData(:, 1), result);
Then remove the data you don't want:
outFiltered = outData(~whichToRemove, :);
I'm honestly not sure what you're doing with "leon" and "leonSum", but this is what you described.
-Cam

Plus de réponses (0)

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by