minimum value and its index

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 个评论

Why are you calling them vectors? Can you explain how are v1,v2, v3 & v4 imported to simulink?
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.

请先登录,再进行评论。

 采纳的回答

the cyclist
the cyclist 2013-2-11
编辑:the cyclist 2013-2-11
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 个评论

Thank you very much! Your answer solved my problem perfectly!
Nice to see that a 3-year-old answer can still help someone!
Now a 7 year old answer can help me, thank you!

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 General Applications 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by