Build script with data with timestamps

2 次查看(过去 30 天)
I some excel with data, one is this:
Where there is a timestamp ( number) that represents yyymmddHHMM (yearsmonthsdayshoursminutes)
I have another Excel with the following shape:
And Im creating a code in matlab where I have to use this data. But im having issues when using the timestamps because in the secound one, I will have to take into account at what timestamp I got the data, and at what timestamp the program has to use it.
The problem then is that I dont know how to make a loop where:
For a certain timestamp Do certain matematical operation with the corresponding data of colum (B in the first excel) and colum(D) in the second on ( is an example).
I have tried to create a timedata arrow ( and I manage to do so with the following code) if true %TIME is a column array with the timestamps
str=num2str(TIME,'%11d');
%TIME is a column array with the timestamps
dn = datenum(str, 'yyyymmddHHMM');
ds = datestr(dn, 'yyyy-mm-dd HH:MM'); % ‘Legacy’ Functions
TIMED = datetime(str, 'InputFormat','yyyyMMddHHmm', 'Format','yyyy-MM-dd HH:mm') % ‘datetime’ Function
TIME=array2table(TIMED)
PRICETABLE(:,1)= TIME
And now I have the data in two vectors ( dont know if it is a good idea)
But now im not able to make loops.
Thanks in advance

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Type Conversion 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by