# Assigning an arbitrary number to an array

2 Ansichten (letzte 30 Tage)
Joseph McGorry am 20 Aug. 2021
Kommentiert: Joseph McGorry am 20 Aug. 2021
My code is
x = [2.32, 4.23, 1.92, 3.24, 2.13];
points = [3, 1, 2];
the first_answer gives 1.92, 2.32, 4.23 the second_answer gives 1.92 and i need the first answer to give me the value 3 which is the smallest x-value, not it's position of X which is 1 but the number it is assigned to which is 3. I do not know what code I need to achieve this. Thanks in advance for any help thanks
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
Stephen23 am 20 Aug. 2021
Bearbeitet: Stephen23 am 20 Aug. 2021
"...i need the first answer to give me the value 3 which is the smallest x-value"

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Stephen23 am 20 Aug. 2021
x = [2.32, 4.23, 1.92, 3.24, 2.13];
points = [3, 1, 2];
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
Joseph McGorry am 20 Aug. 2021
Thank you very much this is what I was after

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by