how to find the max and min numbers by comparing each and every adjacent element in an array?

i have an array say A=[-2, 4, -5, 6] now i want to find the max and min value bewteen each adjacent numbers. for example, A=[-2,4,-5,6] answer should be between [-2,4] 4 is max and -2 is min and again between [4,-5] 4 is max and -5 is min

Products

Asked:

on 19 Oct 2015

Commented:

on 19 Oct 2015

Community Treasure Hunt

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

Start Hunting!