필터 지우기
필터 지우기

Searching the location of a specific cell in a cell array

조회 수: 1 (최근 30일)
nicolas
nicolas 2013년 5월 8일
Hello community! I have a cell array (1x1000) like this {[1 2], [3 5], [4,2],..., [2 5]} I found the most commonly occurring cell in this, but now I want to find the positions of this cell. Example what is the position of cell [2 5]? and the answer I want to be the (1, 100) (1,205) (1,276) etc
Please help, if anyone knows.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 5월 8일
편집: Azzi Abdelmalek 2013년 5월 8일
v={[1 2], [3 5], [4,2],[3 5] ,[4 2]}
w=cell2mat(v')
idx=find(ismember(w,[4,2],'rows'))
  댓글 수: 3
Azzi Abdelmalek
Azzi Abdelmalek 2013년 5월 9일
v={[1 2], [3 5], [4,2],[3 5],[],[4 2]}
idx=find(cellfun(@(x) isequal(x,[4,2]),v))
nicolas
nicolas 2013년 5월 9일
its working! Thank you so much

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by