Finding corresponding value of one vector in another vector

Hi, for example if I have vectors A = [0 1 2 3 4 5 6 7 8 9 10] and B = [0 100 200 300 400 500 600 700 800 900 1000]. and am getting asked to find the value of B when A=7, how do I do that?
Thank you!

 Akzeptierte Antwort

A = [0 1 2 3 4 5 6 7 8 9 10];
B = [0 100 200 300 400 500 600 700 800 900 1000];
result = B(A==7)
result = 700

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Hilfe-Center und File Exchange

Produkte

Gefragt:

am 13 Nov. 2023

Beantwortet:

am 13 Nov. 2023

Community Treasure Hunt

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

Start Hunting!

Translated by