How do I find the cell index ??

조회 수: 5 (최근 30일)
BHUKYA VENKATESH
BHUKYA VENKATESH 2022년 6월 27일
댓글: BHUKYA VENKATESH 2022년 6월 27일
I have a cell A{3}={[1 2 3 1]} {[5 6 7 5 0]} {[9 9 10 10 12]}
I want to find the the cell number that contain 12
that is A{3}
is there any code that finds the cell number??
I dont want to use any kind of loop here.
  댓글 수: 3
BHUKYA VENKATESH
BHUKYA VENKATESH 2022년 6월 27일
Thanks a lot.
BHUKYA VENKATESH
BHUKYA VENKATESH 2022년 6월 27일
@Johan Pelloux-Prayer if I want to know the cell that contain 12, 1, 0 the? the ans is 3, 1,2

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

채택된 답변

madrix
madrix 2022년 6월 27일
A={[1 2 3 1],[5 6 7 5 0],[9 9 10 10 12]};
rem = cellfun(@(x) find(x == 12),A,'un',0);
idx = cellfun('isempty',rem);
find(~idx)
ans = 3

추가 답변 (0개)

카테고리

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

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by