Pairwise subtraction of rows in the same matrix
Mostra commenti meno recenti
Hello guys...
Please I have this code
How can I subtract each row from all other rows(R) ... like subtracting R1-R1; R1-R2, R1-R3... R1-Rn+1 AND
then R2-R1, R2-R3.... R2-Rn+1 for all the rows
A1 = [...
0 0 1 1 1
0 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
0 0 1 1 1
1 0 1 0 1
0 0 0 0 1
1 1 1 1 1
1 1 1 1 1
0 1 1 1 1
1 0 1 0 1
0 0 1 0 1
1 1 1 1 1
1 1 1 1 1
1 0 1 1 1
0 0 1 1 1
0 1 1 1 1
1 1 1 1 1];
I need this urgently....
Thanks
6 Commenti
per isakson
il 11 Mag 2019
Is the expected result one matrix of the same size as A1 ?
David Goodmanson
il 11 Mag 2019
Modificato: David Goodmanson
il 12 Mag 2019
Hi Adedeji,
In the more recent versions of Matlab the expression
A - A(:,n)
conveniently subtracts the nth column of A from each and every column of A.
[comment intended to provide an expression that could be used as a building block]
Adedeji
il 12 Mag 2019
Image Analyst
il 12 Mag 2019
Why do you need this quirky thing? Is it homework?
Have you tried diff()?
Adedeji
il 12 Mag 2019
Adedeji
il 12 Mag 2019
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Operators and Elementary Operations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!