Split an array based on defining a limit for the first value (left edge)

2 次查看(过去 30 天)
Hi all,
I have data for wind speed as shown in the image. The points of interest is when the data first hits 20, and from here, all points are recorded and stored in anh array until the data hits 30. All occasions where this trend occures are stored as seperate arrays within a cellarray. However, i am noticing that some of the arrays have incorrectly stored data. For example, "Array 2" incorrectly uses where the data first decreases below 30 as the first value, and then correctly records the final value where data next hits 30m/s. However, i want the first point of "Array 2" to start where data first reaches 20. The corrected version of Array 2 is visualised in orange.
Is there any way of defining a limit for the first value of all arrays generated? Such as for Array 2, i would like a code to read all data points in the array from left to right, and remove values so that the first value of the array becomes roughly 20 m/s (plus or minus 2 m/s).
Thanks very much !

回答(1 个)

KSSV
KSSV 2021-11-10
You check the initial time value and final time value of the array. If they are not like what you wanted, you can do interpolation and get the values at the required dates. Read about interp1.

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by