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

Azzi Abdelmalek
Azzi Abdelmalek 2013년 2월 11일
Why are you calling them vectors? Can you explain how are v1,v2, v3 & v4 imported to simulink?
Nadia
Nadia 2013년 2월 12일
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일

2 개 추천

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

Guodong Liang
Guodong Liang 2016년 4월 11일
Thank you very much! Your answer solved my problem perfectly!
the cyclist
the cyclist 2016년 4월 12일
Nice to see that a 3-year-old answer can still help someone!
Alex Latham
Alex Latham 2020년 10월 22일
Now a 7 year old answer can help me, thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 General Applications에 대해 자세히 알아보기

제품

질문:

2013년 2월 11일

댓글:

2020년 10월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by