so i have this matrix
data =
1
3
4
3
5
2
5
i need to get new data by subtracting the element like this
data2-data1
data3-data2
data4-data3
data5-data4
data6-data5
data7-data4
...
datan-data(n-1)
so from that data the output should be im =
2
1
-1
2
-3
3
i still trying to manipulate this code but got an error
clc
data=[1;3;4;3;5;2;5]
cnt=size(data,1)
for i=1:cnt;
im=(data(i)-(data(i-1)));
end
im