MATLAB: I have a data set as below , How can i assign T values : 49 as 1 and 53 as 5 and so on considering the gap between the time (49,53,54…10,16) in seconds, it is always not 4 s at the begining and end , it vary as 2 s , 3 s, and so on… i would be

assign "x" values as different value

T(s) Cnt
49.00 804.00
53.00 717.00
54.00 613.00
55.00 603.00
56.00 630.00
57.00 580.00
58.00 566.00
59.00 643.00
1.00 672.00
2.00 651.00
3.00 675.00
4.00 650.00
5.00 653.00
6.00 605.00
7.00 567.00
8.00 678.00
9.00 760.00
10.00 824.00
16.00 798.00

Best Answer

Assuming your data is held in a matrix as follows:
data = [49.00 804.00
53.00 717.00
54.00 613.00
55.00 603.00
56.00 630.00
57.00 580.00
58.00 566.00
59.00 643.00
1.00 672.00
2.00 651.00
3.00 675.00
4.00 650.00
5.00 653.00
6.00 605.00
7.00 567.00
8.00 678.00
9.00 760.00
10.00 824.00
16.00 798.00];
The difficulty comes from your time wrapping around back to 0 after 60 seconds. You can cope with that by calculating the time difference between rows modulo 60:
timeoffsets = mod(diff(data(:, 1)), 60);
To get back to your time but starting at 1, you can then cumsum these offsets:
data(:, 1) = [0; cumsum(timeoffsets)] + 1