Subtraction of elements in successive rows
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Shreya George
el 1 de Feb. de 2021
Comentada: Shreya George
el 2 de Feb. de 2021
I have a matrix 'a'. I need an output matrix 'A' with each row equal to the difference between successive rows of the parent matrix 'a'. Is there a way to do this? I tried coding it in the following manner but keep getting an error message 'Unable to perform assignment because the left and right sides have a different number of elements.'
a=[1 2;2 4;3 6];
A=zeros(2,2);
for i=1:2
A(i)=(a(i+1,:)-a(i,:));
end
The expected result is A=[1 2; 1 2]
0 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Encryption / Cryptography 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!