All combinations of the sum of 2 columns
2 次查看(过去 30 天)
显示 更早的评论
I am looking to combine each of these columns to find the greatest x. I need to check every combination of the two columns that are being subtracted from eachother. Im only ever going to be comparing 2 columns together at once. After x has a new matrix I'm going to pull max to continue. This is a simplified version of my code, I have many columns that I am pulling from excel to compare.
a = [29;31;34]
b = [31;31;31]
x = (b-a) % all possibilities for b-a
0 个评论
采纳的回答
Torsten
2022-10-2
a = [29;31;34].' ;
b = [31;31;31] ;
x = b-a
xmax = max(x(:))
1 个评论
Walter Roberson
2022-10-2
The max will be max(b)-min(a) or max(a)-min(b). If you use bounds() you can calculate these efficiently.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!