Azzera filtri
Azzera filtri

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

3 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Beñat Arribas
Beñat Arribas il 31 Ott 2023
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!

Più risposte (0)

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Prodotti


Release

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by