basically ill have 2 identical sized arrays with different values
A = [1, 4, 7, 10]
B = [4, 5, 1, 8]
and using the minumium value in B (1) i want to pull the value in the same position as A (7)

 Akzeptierte Antwort

KSSV
KSSV am 29 Mär. 2021
Bearbeitet: KSSV am 29 Mär. 2021
REad about min function, it also give you the index/ location of the minimum value.
A = [1, 4, 7, 10] ;
B = [4, 5, 1, 8] ;
[val,idx] = min(B)
val = 1
idx = 3
A(idx)
ans = 7

Weitere Antworten (0)

Produkte

Version

R2018b

Tags

Gefragt:

am 29 Mär. 2021

Bearbeitet:

am 29 Mär. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by