Hi, How do you find the minimum poositive real number for example d=[73 -1.07 1.08 0.01]
i want 0.01 min(d) gives -1.07

 Respuesta aceptada

Stephen23
Stephen23 el 18 de Mayo de 2016
Use logical indexing first:
>> d = [73 -1.07 1.08 0.01];
>> min(d(d>0))
ans =
0.01

3 comentarios

shashank
shashank el 18 de Mayo de 2016
thanks
shashank
shashank el 18 de Mayo de 2016
Thinking of it is there a way to find a second highest number like for this case 1.08
Image Analyst
Image Analyst el 19 de Mayo de 2016
Try sorting:
d = [73 -1.07 1.08 0.01];
sorted_d = sort(d(d>0), 'descend')
secondHighest = sorted_d(2)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Etiquetas

Preguntada:

el 18 de Mayo de 2016

Comentada:

el 19 de Mayo de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by