Filtering dates from matrix

4 次查看(过去 30 天)
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'.

采纳的回答

Cam Salzberger
Cam Salzberger 2017-10-23
编辑:Cam Salzberger 2017-10-23
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by