필터 지우기
필터 지우기

I want to know the starting index of consecutive negative elements and also thier count.

조회 수: 2 (최근 30일)
I just have an array of 76140 data. What to do, if I want to know the starting index of consecutive negative elements and also thier count. Thank you in advance
  댓글 수: 1
Rik
Rik 2021년 3월 29일
Good for you. Do you also have a question? Have you tried anything?
The RunLength FEX submission may be helpful.

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

답변 (1개)

Matt J
Matt J 2021년 3월 29일
편집: Matt J 2021년 3월 29일
Using this File Exchange submission,
yourVector = [0 -3 -4 1 2 7 -9 -10 -11]; %example
G=groupTrue(yourVector<0);
startingIndex = groupFcn(@(x) x(1) , 1:numel(G), G),
startingIndex = 1×2
2 7
count = groupFcn(@numel , G, G),
count = 1×2
2 3

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by