subtract values inside a array
Mostrar comentarios más antiguos
any help will be great. Thank you

Respuesta aceptada
Más respuestas (2)
Birdman
el 22 de En. de 2018
Not the most efficient, but a solution:
init=50;
a=[init 12 2 6 8 6 2 12]
for i=1:numel(a)-1
val=a(1)-a(2);
b(i)=val;
a(1)=[];
a(1)=val;
end
disp(b)
1 comentario
Mohamed Musni
el 22 de En. de 2018
Mohammed Bahubayl
el 22 de En. de 2018
Editada: Mohammed Bahubayl
el 22 de En. de 2018
function output =difff(x)
intial=50;
output=[];
for i=1:length(x)
output(end+1)=intial-x(i);
intial=output(end);
end
end
1 comentario
Mohamed Musni
el 22 de En. de 2018
Categorías
Más información sobre Matrices and Arrays en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!