I want to create a matrix where each column is obtained by subtracting 1 from the previous column.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
KOOKMIN UNIV
el 10 de Mayo de 2016
Respondida: Guillaume
el 10 de Mayo de 2016
For example: A=[4 3 2 1 0; 3 2 1 0 -1; 1 0 -1 -2 -3]
0 comentarios
Respuesta aceptada
Guillaume
el 10 de Mayo de 2016
Use a loop, repmat or bsxfun. e.g:
startcolumn = [4; 3; 1];
numcolumns = 5;
A = bsxfun(@minus, startcolumn, 0:numcolumns-1)
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!