minimum value and its index

2 visualizaciones (últimos 30 días)
Nadia
Nadia el 11 de Feb. de 2013
Comentada: Alex Latham el 22 de Oct. de 2020
Dear all,
If I had 4 vectors each has one number like v1=56.3; v2=40.55; v3=-89.1; v4=74.2. How would I get the minimum value and its index in Simulink? In this case, the minimum is -89.1 and the index is 3.
Many thanks, Nadia
  2 comentarios
Azzi Abdelmalek
Azzi Abdelmalek el 11 de Feb. de 2013
Why are you calling them vectors? Can you explain how are v1,v2, v3 & v4 imported to simulink?
Nadia
Nadia el 12 de Feb. de 2013
Actually, I am talking about my Simulink design. The outputs of 4 blocks in Simulink is 4 vectors (numbers) which are v1, v2, v3 and v4. Now, I need to find the minimum and its index in Simulink environment not in MATLAB. Is there a block can do that? Thanks.

Iniciar sesión para comentar.

Respuesta aceptada

the cyclist
the cyclist el 11 de Feb. de 2013
Editada: the cyclist el 11 de Feb. de 2013
I don't know if it is the same in Simulink, but in MATLAB you can do this as
[minval,idx] = min([v1,v2,v3,v4])
  3 comentarios
the cyclist
the cyclist el 12 de Abr. de 2016
Nice to see that a 3-year-old answer can still help someone!
Alex Latham
Alex Latham el 22 de Oct. de 2020
Now a 7 year old answer can help me, thank you!

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by