how to find the max and min numbers by comparing each and every adjacent element in an array?
Mostrar comentarios más antiguos
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
Respuestas (1)
Walter Roberson
el 19 de Oct. de 2015
At = [A(1:end-1); A(2:end)];
Amin = min(At);
Amax = max(At);
1 comentario
pavithra s
el 19 de Oct. de 2015
Categorías
Más información sobre Programming en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!