How to get the max value between two elements of two separate arrays?
44 ビュー (過去 30 日間)
古いコメントを表示
Luis Angel Manriquez Ramirez
2022 年 10 月 21 日
Hello everyone, thanks for reading
What I'm trying to do is this:
I have these two arrays:
a= [1,3,4,6]
b= [2,2,5,4]
I want to get a new 'c' array with the max values of a comparison between each element of 'a' and 'b'
this -----------> c= [2,3,5,6]
0 件のコメント
採用された回答
その他の回答 (1 件)
Stephen23
2022 年 10 月 21 日
The efficient MATLAB approach:
a = [1,3,4,6];
b = [2,2,5,4];
c = max(a,b)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!