how to get the index of the same element in a cell

조회 수: 1 (최근 30일)
Roger
Roger 2014년 9월 15일
편집: Image Analyst 2014년 9월 15일
if true
Qzonenum=unique(cgroup);
for i = 1:length(Qzonenum)
globidx=find(cgroup==Qzonenum{i});
end
end
then error:Undefined function 'eq' for input arguments of type 'cell'.

채택된 답변

Image Analyst
Image Analyst 2014년 9월 15일
Scrap all that and just use ismember() instead.
  댓글 수: 2
Roger
Roger 2014년 9월 15일
globidx = find(ismember(cgroup,Qzonenum{i})==1); thanks
Image Analyst
Image Analyst 2014년 9월 15일
편집: Image Analyst 2014년 9월 15일
You should be able to drop the ==1 part.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Optimization에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by