필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

calculating most days with gain

조회 수: 3 (최근 30일)
John Jamison
John Jamison 2017년 2월 18일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi,
I am having some trouble calculating this...I am started with a for loop, iterating over 1:length of my data set, put don't know where to go to get the setup for tracking streaks and days in a row for gains...please help.
THANKS

답변 (1개)

Walter Roberson
Walter Roberson 2017년 2월 18일
mask = [0,closing > opening,0];
Now have a look at
find(mask(1:end-1) & ~mask(2:end))
This tells you about the end of streaks. You can likewise find the beginning of streaks. Each beginning has an end. You can figure out lengths by matching positions
  댓글 수: 2
John Jamison
John Jamison 2017년 2월 18일
how does this help with the problem I attached above? where would i enter this
Walter Roberson
Walter Roberson 2017년 2월 18일
Your task does not depend on how much gain is made, just that some gain is made. So you can calculate a vector of 1 (gain made) and 0 (not a gain ) and now the task is to find the place with the greatest streak of 1s.

이 질문은 마감되었습니다.

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by