MATLAB: Removing maxium and minimum from the matrix

minimum and maximum

Hi, I have a 24×4 matrix I would like to remove the minimum and maximum of 2nd column and it's corresponding value in the 1st column from the matrix. Any help would be appreciated.
Here's a example table D =
100.00 7.80
200.00 7.50
300.00 8.50
400.00 8.40
500.00 11.10
600.00 14.50
700.00 22.60
800.00 34.90
900.00 30.00
1000.00 29.50
1100.00 21.30
1200.00 20.50
1300.00 18.40
1400.00 15.60
1500.00 14.00
1600.00 13.90
1700.00 13.00
1800.00 11.80
1900.00 12.40
2000.00 13.40
2100.00 5.60
2200.00 6.70
2300.00 6.40
2400.00 5.90
When I do [a,b]=min(D)
a =
100.00 5.60
b =
1.00 21.00
[c,d]=max(D)
c =
2400.00 34.90
d =
24.00 8.00
when I do sortrows(D,2) it looks like this
sortrows(D,2)
ans =
2100.00 5.60
2400.00 5.90
2300.00 6.40
2200.00 6.70
200.00 7.50
100.00 7.80
400.00 8.40
300.00 8.50
500.00 11.10
1800.00 11.80
1900.00 12.40
1700.00 13.00
2000.00 13.40
1600.00 13.90
1500.00 14.00
600.00 14.50
1400.00 15.60
1300.00 18.40
1200.00 20.50
1100.00 21.30
700.00 22.60
1000.00 29.50
900.00 30.00
800.00 34.90
I want it to look like this
2400.00 5.90
2300.00 6.40
2200.00 6.70
200.00 7.50
100.00 7.80
400.00 8.40
300.00 8.50
500.00 11.10
1800.00 11.80
1900.00 12.40
1700.00 13.00
2000.00 13.40
1600.00 13.90
1500.00 14.00
600.00 14.50
1400.00 15.60
1300.00 18.40
1200.00 20.50
1100.00 21.30
700.00 22.60
1000.00 29.50
900.00 30.00
notice both the max and min values of column 2(which were 5.60 and 34.90, along with their corresponding values from column 1) gone from the matrix.

Best Answer

How about this:
format long g
workspace;
D =[...
100.00 7.80
200.00 7.50
300.00 8.50
400.00 8.40
500.00 11.10
600.00 14.50
700.00 22.60
800.00 34.90
900.00 30.00
1000.00 29.50
1100.00 21.30
1200.00 20.50
1300.00 18.40
1400.00 15.60
1500.00 14.00
1600.00 13.90
1700.00 13.00
1800.00 11.80
1900.00 12.40
2000.00 13.40
2100.00 5.60
2200.00 6.70
2300.00 6.40
2400.00 5.90]
[minValue, rowsToDelete1] = min(D(:,2))
[maxValue, rowsToDelete2] = max(D(:,2))
D([rowsToDelete1, rowsToDelete2], :) = []; % Get rid of min(s) and max(es).
D % Print out