Finding max and min value for each number interval

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 Comments

Jon
Jon on 1 Oct 2020
Edited: Jon on 1 Oct 2020
Sorry it still isn't quite clear to me what you are trying to do. Can you please try to extend your explanation. It would most helpful if you could provide an actual example input set of values and and the resulting output set of numbers you are trying to obtain.
here there is an example. I have a lot of numbers. I need the max and min value for each set of data. like, for 0.14 I need its x and min value. same for 0.15, 0.16 etc. in this way I can extract max and min value and apply interpolation. hope it is more clear now. thank you!
I'm sorry but I still can't understands. Please give a specific example. Something like, here are a set of example input values, here are the results (answers) I am looking for.
I attached a photo. Highlighted ones what i look for among the set of data.
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.

Sign in to comment.

 Accepted Answer

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

More Answers (0)

Products

Release

R2020b

Asked:

on 1 Oct 2020

Edited:

on 1 Oct 2020

Community Treasure Hunt

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

Start Hunting!