Filtering dates from matrix

조회 수: 1 (최근 30일)
AA
AA 2017년 10월 23일
편집: Cam Salzberger 2017년 10월 23일
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