update vector with nubers from another vector
2 ビュー (過去 30 日間)
古いコメントを表示
Hi
I have a vector A = [ 2 4 6 10 15] and another vector B = [2.43 2.3 12 5.1]
How can I transform so that B = [2 2 10 6] with the help of A.
2 件のコメント
採用された回答
the cyclist
2019 年 11 月 28 日
A = [ 2 4 6 10 15];
B = [2.43 2.3 12 5.1];
[~,idx] = min(abs(B'-A),[],2);
B = A(idx)
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!