Find the index of an interval of values in cell array

조회 수: 7 (최근 30일)
Tesla
Tesla 2021년 10월 21일
댓글: Stephen23 2021년 10월 21일
I have a cell array 1X500, and inside evey cell 6000 value.
I want to find the index on the values (it has to be between 1 and 500) if the values s are : 500<s< 956
I tried with
index = cellfun(@(x) 500 < x < 956, SS, 'uniform', false);
But I didnt get the index

답변 (1개)

Stephen23
Stephen23 2021년 10월 21일
index = cellfun(@(x) 500<x & x<956, SS, 'uniform', false);
  댓글 수: 2
Tesla
Tesla 2021년 10월 21일
It gaves the same results,
I want to return just the index of which cell we have 500<x & x<956. for example getting an output like [ 2 10 23 89 200]
Stephen23
Stephen23 2021년 10월 21일
index = find(cellfun(@(x) any(500<x(:) & x(:)<956), SS))

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by