フィルターのクリア

How to find the minimum of an array element, but in a interval?

3 ビュー (過去 30 日間)
Davide Cannavacciuolo
Davide Cannavacciuolo 2023 年 10 月 31 日
移動済み: Dyuman Joshi 2023 年 11 月 2 日
I have an array A=[0.5 3 10]
I want x=3.
In general how to extract from an array minimum element in a interval. In this case is between for example between 1 and inf.
  2 件のコメント
Dyuman Joshi
Dyuman Joshi 2023 年 10 月 31 日
移動済み: Dyuman Joshi 2023 年 11 月 2 日
Use logical indexing (Find Array Elements That Meet a Condition) to find the values in the given range and then use min.
Dyuman Joshi
Dyuman Joshi 2023 年 10 月 31 日
移動済み: Dyuman Joshi 2023 年 11 月 2 日
Well.

サインインしてコメントする。

採用された回答

Beñat Arribas
Beñat Arribas 2023 年 10 月 31 日
I propose you a simple way to do that.
You can filter from the array the numbers that are in the interval first:
A=[0.5 3 10];
A_new = A(>=1 & A<inf)
This way A_new will contain the values A_new=[3, 10]. Then you can use the min() function:
minimum = min(A_new)
Hope it answers your question!

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by