Finding max and min value for each number interval

5 vues (au cours des 30 derniers jours)
Nagihan ERDEM
Nagihan ERDEM le 1 Oct 2020
Modifié(e) : Matt J le 1 Oct 2020
Hello,
I have stress strain data which has 5000 rows and I need to clean unnecesaay number. I only need max and min value for each number interval to perform interpolation. i dont know how to explain let me give you an example:
x=1.1,1.2, 1.3, 1.4, 1.9, 2.1, 2.2, 2.5 ,2.7, 2.9, 3.1, 3.4...... and i only need 1.9 and 2.1 2.9 and 3.0 to do interpolation. for the number 1 i need max and min value. for the number 2 i need min and max value and so on... Thank you so much in advance. I am sorry if I violete any rule. this is my first question here.
  5 commentaires
Nagihan ERDEM
Nagihan ERDEM le 1 Oct 2020
I attached a photo. Highlighted ones what i look for among the set of data.
Matt J
Matt J le 1 Oct 2020
Modifié(e) : Matt J le 1 Oct 2020
I need the max and min value for each set of data
But you've only shown us a single sequence of numbers. You haven't explained how those numbers are to be divided into sets. In your first example, it looks maybe sort-of like every number that is the same up to 0 decimal places form a set. In your second example, it looks like numbers which are the same up to the first two decimals form a set.

Connectez-vous pour commenter.

Réponse acceptée

Matt J
Matt J le 1 Oct 2020
Using your example,
>> x=[1.1,1.2, 1.3, 1.4, 1.9, 2.1, 2.2, 2.5 ,2.7, 2.9, 3.1, 3.4];
>> xg=findgroups(fix(x))
xg =
1 1 1 1 1 2 2 2 2 2 3 3
>> intervalMin=splitapply(@min,x,xg)
intervalMin =
1.1000 2.1000 3.1000
>> intervalMax=splitapply(@max,x,xg)
intervalMax =
1.9000 2.9000 3.4000

Plus de réponses (0)

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by