Find min values in sequence time series

Dear all I like to ask your help for this Matlab function to find mean value of a sequence dataset as demonstrated in Figure below.
Column 5 is min of a range values in column 3 based on column 4 (with fd =1).
Thank you very much

 채택된 답변

KSSV
KSSV 2018년 10월 31일

0 개 추천

As the data is not given, I have created some random data...check the code:
v = [1 2 3 0 0 0 0 0 2 3 4 0 0 0 0 0 4 5 6 7 0 0 0 0 1 1 1]';
A = rand(27,4) ;
A(:,4) = v ;
w = [false; v~=0 ;false];
starts = find(w(2:end) & ~w(1:end-1)); %Get starts of runs of non-zeros
ends = find(~w(2:end) & w(1:end-1))-1; % Get ends of runs of non-zeros
result = arrayfun(@(s,e) A(s:e,1:3), starts, ends, 'uniformout', false); % extract the respective parts
iwant = cellfun(@mean,result,'uniformout',false)

댓글 수: 2

dau
dau 2018년 10월 31일
편집: dau 2018년 10월 31일
Thank you very much for your code. It worked for me now. Again. thank you so much for your kind helps
dau
dau 2018년 10월 31일
Can i ask one more thing, since i want to get min value then i change your expression to:
iwant = cellfun(@min,result,'uniformout',false)
I next step want to divide the iwant to the first column with the same value such as: In the first sequence, the min value equaled -187.1, then next result1 = -187.1 / 421.9 (in the first column). This will repeat to the next sequences, ex: result2 = -596.3 /824.5
Thank you

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

제품

릴리스

R2014b

질문:

dau
2018년 10월 30일

댓글:

dau
2018년 10월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by