I want to create a matrix where each column is obtained by subtracting 1 from the previous column.
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
For example: A=[4 3 2 1 0; 3 2 1 0 -1; 1 0 -1 -2 -3]
0 Commenti
Risposta accettata
Guillaume
il 10 Mag 2016
Use a loop, repmat or bsxfun. e.g:
startcolumn = [4; 3; 1];
numcolumns = 5;
A = bsxfun(@minus, startcolumn, 0:numcolumns-1)
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Matrix Indexing 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!