How to extract data between start and end points of flood as separate events?

2 visualizaciones (últimos 30 días)
Hello,
I have a code that calculates Start, Peak, and end points for a specified peak over threshold flood. i.e., the number of peakes indicates the number of flood events that exceeds a threshold in that dataseries. now i want to extract the data for each event and use it as separate variables. can anyone helpe with this please?? i have included an example for demonstration of what i neet.
peak points=(1:n)
start points=(1:n)
end points=(1:n)
ev1(data)=data between st(1):en(1)
ev2(data)=data between st(2):en(2)
.
.
ev(n)(data)=data between st(n):en(n)

Respuestas (1)

Walter Roberson
Walter Roberson el 20 de Abr. de 2021
ev = arrayfun(@(sp, ep) peakpoints(sp:ep), start_points, end_points, 'uniform', 0);
  2 comentarios
Hazhan Majeed
Hazhan Majeed el 20 de Abr. de 2021
Hi Walter Robenson
thanks for your help. it gives me this error
ev = arrayfun(@(shloc,ehloc) pksloc(shloc:ehloc), shloc, ehloc, 'uniform', 0);
Nonfinite endpoints or increment for colon operator in index.
Error in @(shloc,ehloc)pksloc(shloc:ehloc)
Walter Roberson
Walter Roberson el 20 de Abr. de 2021
Editada: Walter Roberson el 20 de Abr. de 2021
Could you confirm that your shloc and ehloc are indices, and not x values? And also that none of the values is -inf or inf or nan ?
Also, I recommend against using the same dummy variable names for the anonymous function as you use full variable names: what you did gets confusing over whether at any point the name refers to the vector or to a particular entry in the vector. That is why I used sp and ep instead of start_points and end_points to make it clear within the anonymous function call that you were working with single values passed in at that point, not with the entire vector.

Iniciar sesión para comentar.

Categorías

Más información sobre Animation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by