フィルターのクリア

display the value from a vector

2 ビュー (過去 30 日間)
Costi Gilca
Costi Gilca 2016 年 4 月 24 日
回答済み: Peta 2016 年 4 月 24 日
Hello,
I have 2 vectors like this: a=[ 95 120 115 132 ...] b=[ 300 250 375 320 ...] Each set of values are associated so when I use minimum for the elements of first vector I want to display myself the value associated from the second vector: For example: if the minimum value in vector a is 95 I want to show me the 300 value, if the minimum is 115 I want to display 375 etc. Could anybody help me, please? Thank you

採用された回答

Peta
Peta 2016 年 4 月 24 日
This is what I usually do:
% Find the index of the minimum value in a and store it in the variable pos.
[~,pos] = min(a);
% Use pos to get the corresponding value from b:
b(pos)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by