Borrar filtros
Borrar filtros

finding the maximum of values after and before a specific value

6 visualizaciones (últimos 30 días)
hello, I have a doubt.Is it possible to find out the maximum values before and after the ith element in an array?
  2 comentarios
Adam
Adam el 19 de Dic. de 2017
Editada: Adam el 19 de Dic. de 2017
yes
max( array( ( i + 1 ):end ) )
max( 1:( i - 1 ) )

Iniciar sesión para comentar.

Respuesta aceptada

Birdman
Birdman el 19 de Dic. de 2017
One approach:
a=randi([1 10],1,10);
ind=4;%4th element in a vector is chosen
a1=a(1:ind-1);
a2=a(ind+1,end);
max(a1)
max(a2)

Más respuestas (0)

Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by