필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How can I write a function for the below cell array comparison?

조회 수: 1 (최근 30일)
Supreet Hegde
Supreet Hegde 2015년 7월 22일
마감: MATLAB Answer Bot 2021년 8월 20일
I have a huge data of cell arrays (2000*10) with each cell containing strings such as '25:20:55'.
I want to write a function that accepts 10 inputs (say '25:02:33', '58:69:88', '25:54:96', '48:58:36', '58:54:88' and so on) and looks for a match in each column corresponding to input value for that particular column (i.e. the first input data corresponds to 1st column, 2nd to 2nd column of the stored data and so on.

답변 (1개)

Titus Edelhofer
Titus Edelhofer 2015년 7월 22일
Hi Supreet,
I think this is one of the cases where a simple loop is easier than trying to do something very clever:
X = cell(2000, 10);
Y = cell(1, 10);
result = cell(1, 10);
for i=1:10
result{i} = ismember(Y{i}, X(:,i));
end
Titus

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by