Filtering dates from matrix

1 visualización (últimos 30 días)
AA
AA el 23 de Oct. de 2017
Editada: Cam Salzberger el 23 de Oct. de 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'.

Respuesta aceptada

Cam Salzberger
Cam Salzberger el 23 de Oct. de 2017
Editada: Cam Salzberger el 23 de Oct. de 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

Más respuestas (0)

Categorías

Más información sobre Matched Filter and Ambiguity Function en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by