Function output an array
38 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying towrite a function that takes an array of variable size, and calculates the differneces between the 1,2 2,3 3,4 ... inputs and displays as an array (without using the diff function). It keep giving a singular output for the first values but need it to give an array for all. any help would be great.
function [out] = differences(in)
%This function allows an array input and the differences between the array
i=1;
while (i<=size(in))
out(i)= in(i+1)-in(i);
i=i+1;
end
end
0 comentarios
Respuestas (1)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!