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)

 채택된 답변

KSSV
KSSV 2021년 3월 29일
편집: KSSV 2021년 3월 29일
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

추가 답변 (0개)

카테고리

제품

릴리스

R2018b

태그

질문:

2021년 3월 29일

편집:

2021년 3월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by