All combinations of the sum of 2 columns
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Anthony Coppola
il 2 Ott 2022
Commentato: Walter Roberson
il 2 Ott 2022
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 Commenti
Risposta accettata
Torsten
il 2 Ott 2022
a = [29;31;34].' ;
b = [31;31;31] ;
x = b-a
xmax = max(x(:))
1 Commento
Walter Roberson
il 2 Ott 2022
The max will be max(b)-min(a) or max(a)-min(b). If you use bounds() you can calculate these efficiently.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Matrices and Arrays in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!