Error when using interpolation method
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
Dears,
I have a dataset, includes variables serial, year, month, day, second, and price. I want to calculate the 5 minute frequency, using last tick interpolation. When I reaech to the last step, the serial numbers are changed. The codes here are provided by Star Strider.
T1 = readtable('Data.txt');
% (1) is the serial, (2) year, (3) month, (4) days, (5) time in seconds, and (6) price
T1.Properties.VariableNames = {'serial','year','month','day','seconds','price'}
T1 = 9123×6 table
serial year month day seconds price
______ ____ _____ ___ _______ ______
1972 2013 7 31 1 168.98
1972 2013 7 31 2 169
1972 2013 7 31 3 169
1972 2013 7 31 4 168.99
1972 2013 7 31 5 168.98
1972 2013 7 31 6 168.98
1972 2013 7 31 7 168.98
1972 2013 7 31 8 168.98
1972 2013 7 31 9 168.99
1972 2013 7 31 10 168.98
1972 2013 7 31 11 168.97
1972 2013 7 31 12 168.97
1972 2013 7 31 13 168.98
1972 2013 7 31 14 168.97
1972 2013 7 31 16 168.97
1972 2013 7 31 17 168.96
% T1(end-4:end,:)
DT = datetime(T1{:,[2 3 4]}) + seconds(T1{:,5});
T2 = table(DT,T1{:,1},T1{:,6}, 'VariableNames',{'time','serial','price'})
T2 = 9123×3 table
time serial price
____________________ ______ ______
31-Jul-2013 00:00:01 1972 168.98
31-Jul-2013 00:00:02 1972 169
31-Jul-2013 00:00:03 1972 169
31-Jul-2013 00:00:04 1972 168.99
31-Jul-2013 00:00:05 1972 168.98
31-Jul-2013 00:00:06 1972 168.98
31-Jul-2013 00:00:07 1972 168.98
31-Jul-2013 00:00:08 1972 168.98
31-Jul-2013 00:00:09 1972 168.99
31-Jul-2013 00:00:10 1972 168.98
31-Jul-2013 00:00:11 1972 168.97
31-Jul-2013 00:00:12 1972 168.97
31-Jul-2013 00:00:13 1972 168.98
31-Jul-2013 00:00:14 1972 168.97
31-Jul-2013 00:00:16 1972 168.97
31-Jul-2013 00:00:17 1972 168.96
TT2 = table2timetable(T2);
TT2 = retime(TT2,'regular','linear','Timestep',minutes(5))
TT2 = 79×2 timetable
time serial price
____________________ ______ ______
31-Jul-2013 00:00:00 1972 168.96
31-Jul-2013 00:05:00 1972 169.19
31-Jul-2013 00:10:00 1972 169.11
31-Jul-2013 00:15:00 1972 169.04
31-Jul-2013 00:20:00 1972 169.19
31-Jul-2013 00:25:00 1972 169.05
31-Jul-2013 00:30:00 1972 169.14
31-Jul-2013 00:35:00 1972 169.09
31-Jul-2013 00:40:00 1972 169.04
31-Jul-2013 00:45:00 1972 169.06
31-Jul-2013 00:50:00 1972 169.13
31-Jul-2013 00:55:00 1972 169.11
31-Jul-2013 01:00:00 1972 169.45
31-Jul-2013 01:05:00 1972 169.41
31-Jul-2013 01:10:00 1972 169.57
31-Jul-2013 01:15:00 1972 169.56
A simple and results that I got is attached. Could you guide me to get the code accurately.
6 件のコメント
Matt J
2023 年 10 月 28 日
What should it be doing that is different from the results shown above?
in the results (see the attached file) the serial numbers are changed, therefore, whether there is a misstake in the code, or any modifications that should be done?
But the data in Result.txt clearly doesn't come from the code you've posted. We can see the output of the code above, and the serial number is 1972 throughout.
Emad
2023 年 10 月 28 日
It is a sample from the whole results. The whole data is too large. Hopefully to aid me.
Star Strider
2023 年 10 月 28 日
What calculation is necessary to produce the result you want?
I suspect that whatever calculation is is being appliied to the price is being applied to the serial numbers as well, and that is the reason they are changing. The serial numbers probably only need to be interpolated to match the five-minute intervals, and not have any calculations applied to them.
Emad
2023 年 10 月 28 日
The calculation thaI want to get after the interpolation is construct 5 minutes log-returns. That is the goal from the prepration data.
採用された回答
Star Strider
2023 年 10 月 28 日
編集済み: Star Strider
2023 年 10 月 28 日
The serial numbers change position because timetable arrays require that the time vector be the first column, regardless of how the original table was constructed.
The serial numbers themselves do not change. (If they were included in the computations, one approach would simply be to remove them, calculate the timetable, and then re-insert them afterwards, interpolated separately to create an appropriate lrow size. However here they are simply interpolated, since that is all this code does.)
Example —
T1 = readtable('Data.txt');
% (1) is the serial, (2) year, (3) month, (4) days, (5) time in seconds, and (6) price
T1.Properties.VariableNames = {'serial','year','month','day','seconds','price'}
T1 = 9123×6 table
serial year month day seconds price
______ ____ _____ ___ _______ ______
1972 2013 7 31 1 168.98
1972 2013 7 31 2 169
1972 2013 7 31 3 169
1972 2013 7 31 4 168.99
1972 2013 7 31 5 168.98
1972 2013 7 31 6 168.98
1972 2013 7 31 7 168.98
1972 2013 7 31 8 168.98
1972 2013 7 31 9 168.99
1972 2013 7 31 10 168.98
1972 2013 7 31 11 168.97
1972 2013 7 31 12 168.97
1972 2013 7 31 13 168.98
1972 2013 7 31 14 168.97
1972 2013 7 31 16 168.97
1972 2013 7 31 17 168.96
% T1(end-4:end,:)
DT = datetime(T1{:,[2 3 4]}) + seconds(T1{:,5});
% T2 = table(DT,T1{:,1},T1{:,6}, 'VariableNames',{'time','serial','price'})
T2 = table(T1{:,1},DT,T1{:,6}, 'VariableNames',{'serial','time','price'})
T2 = 9123×3 table
serial time price
______ ____________________ ______
1972 31-Jul-2013 00:00:01 168.98
1972 31-Jul-2013 00:00:02 169
1972 31-Jul-2013 00:00:03 169
1972 31-Jul-2013 00:00:04 168.99
1972 31-Jul-2013 00:00:05 168.98
1972 31-Jul-2013 00:00:06 168.98
1972 31-Jul-2013 00:00:07 168.98
1972 31-Jul-2013 00:00:08 168.98
1972 31-Jul-2013 00:00:09 168.99
1972 31-Jul-2013 00:00:10 168.98
1972 31-Jul-2013 00:00:11 168.97
1972 31-Jul-2013 00:00:12 168.97
1972 31-Jul-2013 00:00:13 168.98
1972 31-Jul-2013 00:00:14 168.97
1972 31-Jul-2013 00:00:16 168.97
1972 31-Jul-2013 00:00:17 168.96
T2(end-4:end,:)
ans = 5×3 table
serial time price
______ ____________________ ______
1972 31-Jul-2013 06:29:56 168.65
1972 31-Jul-2013 06:29:57 168.61
1972 31-Jul-2013 06:29:58 168.63
1972 31-Jul-2013 06:29:59 168.62
1972 31-Jul-2013 06:30:00 168.65
TT2 = table2timetable(T2)
TT2 = 9123×2 timetable
time serial price
____________________ ______ ______
31-Jul-2013 00:00:01 1972 168.98
31-Jul-2013 00:00:02 1972 169
31-Jul-2013 00:00:03 1972 169
31-Jul-2013 00:00:04 1972 168.99
31-Jul-2013 00:00:05 1972 168.98
31-Jul-2013 00:00:06 1972 168.98
31-Jul-2013 00:00:07 1972 168.98
31-Jul-2013 00:00:08 1972 168.98
31-Jul-2013 00:00:09 1972 168.99
31-Jul-2013 00:00:10 1972 168.98
31-Jul-2013 00:00:11 1972 168.97
31-Jul-2013 00:00:12 1972 168.97
31-Jul-2013 00:00:13 1972 168.98
31-Jul-2013 00:00:14 1972 168.97
31-Jul-2013 00:00:16 1972 168.97
31-Jul-2013 00:00:17 1972 168.96
TT2 = retime(TT2,'regular','linear','Timestep',minutes(5))
TT2 = 79×2 timetable
time serial price
____________________ ______ ______
31-Jul-2013 00:00:00 1972 168.96
31-Jul-2013 00:05:00 1972 169.19
31-Jul-2013 00:10:00 1972 169.11
31-Jul-2013 00:15:00 1972 169.04
31-Jul-2013 00:20:00 1972 169.19
31-Jul-2013 00:25:00 1972 169.05
31-Jul-2013 00:30:00 1972 169.14
31-Jul-2013 00:35:00 1972 169.09
31-Jul-2013 00:40:00 1972 169.04
31-Jul-2013 00:45:00 1972 169.06
31-Jul-2013 00:50:00 1972 169.13
31-Jul-2013 00:55:00 1972 169.11
31-Jul-2013 01:00:00 1972 169.45
31-Jul-2013 01:05:00 1972 169.41
31-Jul-2013 01:10:00 1972 169.57
31-Jul-2013 01:15:00 1972 169.56
TT2(end-4:end,:)
ans = 5×2 timetable
time serial price
____________________ ______ ______
31-Jul-2013 06:10:00 1972 169.12
31-Jul-2013 06:15:00 1972 168.85
31-Jul-2013 06:20:00 1972 168.7
31-Jul-2013 06:25:00 1972 168.51
31-Jul-2013 06:30:00 1972 168.65
T3 = readtable('Result.txt') % Second File
T3 = 865×4 table
Var1 Var2 Var3 Var4
________________ _____________ ____ ______
{''03-Jan-2005'} {'00:00:00''} 1 121.56
{''03-Jan-2005'} {'00:05:00''} 1 121.64
{''03-Jan-2005'} {'00:10:00''} 1 121.69
{''03-Jan-2005'} {'00:15:00''} 1 121.65
{''03-Jan-2005'} {'00:20:00''} 1 121.65
{''03-Jan-2005'} {'00:25:00''} 1 121.51
{''03-Jan-2005'} {'00:30:00''} 1 121.51
{''03-Jan-2005'} {'00:35:00''} 1 121.29
{''03-Jan-2005'} {'00:40:00''} 1 121.18
{''03-Jan-2005'} {'00:45:00''} 1 121.15
{''03-Jan-2005'} {'00:50:00''} 1 120.99
{''03-Jan-2005'} {'00:55:00''} 1 120.98
{''03-Jan-2005'} {'01:00:00''} 1 120.98
{''03-Jan-2005'} {'01:05:00''} 1 120.92
{''03-Jan-2005'} {'01:10:00''} 1 120.82
{''03-Jan-2005'} {'01:15:00''} 1 120.8
T3(end-4:end,:)
ans = 5×4 table
Var1 Var2 Var3 Var4
________________ _____________ ______ ______
{''05-Jan-2005'} {'23:40:00''} 3.9809 118.44
{''05-Jan-2005'} {'23:45:00''} 3.9857 118.44
{''05-Jan-2005'} {'23:50:00''} 3.9904 118.44
{''05-Jan-2005'} {'23:55:00''} 3.9952 118.44
{''06-Jan-2005'} {'00:00:00''} 3.9999 118.44
Time = datetime(T3.Var1, 'InputFormat','''''dd-MMM-yyyy') + timeofday(datetime(T3.Var2,'InputFormat','HH:mm:ss'''''));
T3 = removevars(T3,[1 2]);
T3 = addvars(T3, Time,'Before','Var3')
T3 = 865×3 table
Time Var3 Var4
____________________ ____ ______
03-Jan-2005 00:00:00 1 121.56
03-Jan-2005 00:05:00 1 121.64
03-Jan-2005 00:10:00 1 121.69
03-Jan-2005 00:15:00 1 121.65
03-Jan-2005 00:20:00 1 121.65
03-Jan-2005 00:25:00 1 121.51
03-Jan-2005 00:30:00 1 121.51
03-Jan-2005 00:35:00 1 121.29
03-Jan-2005 00:40:00 1 121.18
03-Jan-2005 00:45:00 1 121.15
03-Jan-2005 00:50:00 1 120.99
03-Jan-2005 00:55:00 1 120.98
03-Jan-2005 01:00:00 1 120.98
03-Jan-2005 01:05:00 1 120.92
03-Jan-2005 01:10:00 1 120.82
03-Jan-2005 01:15:00 1 120.8
T3(end-4:end,:)
ans = 5×3 table
Time Var3 Var4
____________________ ______ ______
05-Jan-2005 23:40:00 3.9809 118.44
05-Jan-2005 23:45:00 3.9857 118.44
05-Jan-2005 23:50:00 3.9904 118.44
05-Jan-2005 23:55:00 3.9952 118.44
06-Jan-2005 00:00:00 3.9999 118.44
The second file (‘Result.txt’) appears to be entirely different form the first. The variables are not defined, so I have no idea what they are.
.
6 件のコメント
Emad
2023 年 10 月 28 日
The results file is from what I got, i do not know why there are 4 variables, and we only use 3. In this comment I will post the code and the files again to you. What I want to solve is why serial is included in the calculation. As a result the numbers changed.
These are the codes that I used:
T1 = readtable('Data.txt');
T1.Properties.VariableNames = {'Serial','Year','Month','Day','Seconds','Price'};
DT = datetime(T1{:,[2 3 4]}) + seconds(T1{:,5});
T2 = table(DT,T1{:,1},T1{:,6}, 'VariableNames',{'Time','Serial','Price'});
TT2 = table2timetable(T2);
To this step the Serial is ok, and everything is right.
When I use this code,
TT2 = retime(TT2,'regular','linear','Timestep',minutes(5));
The Serial numbers are changed. What I need is to get the reuslts such as in TT2, but the Serial numbers remain.
Star Strider
2023 年 10 月 28 日
編集済み: Star Strider
2023 年 10 月 28 日
My code resamples the timetables using interpolation.
What sort of calculation do you want to use, since that is apparently the objective here. I never heard of what you previously posted so I have no idea how to code it. You need to explain that calculation.
EDIT — (28 Oct 2023 at 21:48)
Apparently, ‘log return’ is:

Then this should work —
T1 = readtable('Data.txt');
% (1) is the serial, (2) year, (3) month, (4) days, (5) time in seconds, and (6) price
T1.Properties.VariableNames = {'serial','year','month','day','seconds','price'}
T1 = 9123×6 table
serial year month day seconds price
______ ____ _____ ___ _______ ______
1972 2013 7 31 1 168.98
1972 2013 7 31 2 169
1972 2013 7 31 3 169
1972 2013 7 31 4 168.99
1972 2013 7 31 5 168.98
1972 2013 7 31 6 168.98
1972 2013 7 31 7 168.98
1972 2013 7 31 8 168.98
1972 2013 7 31 9 168.99
1972 2013 7 31 10 168.98
1972 2013 7 31 11 168.97
1972 2013 7 31 12 168.97
1972 2013 7 31 13 168.98
1972 2013 7 31 14 168.97
1972 2013 7 31 16 168.97
1972 2013 7 31 17 168.96
% T1(end-4:end,:)
DT = datetime(T1{:,[2 3 4]}) + seconds(T1{:,5});
T2 = table(DT,T1{:,1},T1{:,6}, 'VariableNames',{'time','serial','price'})
T2 = 9123×3 table
time serial price
____________________ ______ ______
31-Jul-2013 00:00:01 1972 168.98
31-Jul-2013 00:00:02 1972 169
31-Jul-2013 00:00:03 1972 169
31-Jul-2013 00:00:04 1972 168.99
31-Jul-2013 00:00:05 1972 168.98
31-Jul-2013 00:00:06 1972 168.98
31-Jul-2013 00:00:07 1972 168.98
31-Jul-2013 00:00:08 1972 168.98
31-Jul-2013 00:00:09 1972 168.99
31-Jul-2013 00:00:10 1972 168.98
31-Jul-2013 00:00:11 1972 168.97
31-Jul-2013 00:00:12 1972 168.97
31-Jul-2013 00:00:13 1972 168.98
31-Jul-2013 00:00:14 1972 168.97
31-Jul-2013 00:00:16 1972 168.97
31-Jul-2013 00:00:17 1972 168.96
T2(end-4:end,:)
ans = 5×3 table
time serial price
____________________ ______ ______
31-Jul-2013 06:29:56 1972 168.65
31-Jul-2013 06:29:57 1972 168.61
31-Jul-2013 06:29:58 1972 168.63
31-Jul-2013 06:29:59 1972 168.62
31-Jul-2013 06:30:00 1972 168.65
TT2 = table2timetable(T2)
TT2 = 9123×2 timetable
time serial price
____________________ ______ ______
31-Jul-2013 00:00:01 1972 168.98
31-Jul-2013 00:00:02 1972 169
31-Jul-2013 00:00:03 1972 169
31-Jul-2013 00:00:04 1972 168.99
31-Jul-2013 00:00:05 1972 168.98
31-Jul-2013 00:00:06 1972 168.98
31-Jul-2013 00:00:07 1972 168.98
31-Jul-2013 00:00:08 1972 168.98
31-Jul-2013 00:00:09 1972 168.99
31-Jul-2013 00:00:10 1972 168.98
31-Jul-2013 00:00:11 1972 168.97
31-Jul-2013 00:00:12 1972 168.97
31-Jul-2013 00:00:13 1972 168.98
31-Jul-2013 00:00:14 1972 168.97
31-Jul-2013 00:00:16 1972 168.97
31-Jul-2013 00:00:17 1972 168.96
TT2 = retime(TT2,'regular','linear','Timestep',minutes(5))
TT2 = 79×2 timetable
time serial price
____________________ ______ ______
31-Jul-2013 00:00:00 1972 168.96
31-Jul-2013 00:05:00 1972 169.19
31-Jul-2013 00:10:00 1972 169.11
31-Jul-2013 00:15:00 1972 169.04
31-Jul-2013 00:20:00 1972 169.19
31-Jul-2013 00:25:00 1972 169.05
31-Jul-2013 00:30:00 1972 169.14
31-Jul-2013 00:35:00 1972 169.09
31-Jul-2013 00:40:00 1972 169.04
31-Jul-2013 00:45:00 1972 169.06
31-Jul-2013 00:50:00 1972 169.13
31-Jul-2013 00:55:00 1972 169.11
31-Jul-2013 01:00:00 1972 169.45
31-Jul-2013 01:05:00 1972 169.41
31-Jul-2013 01:10:00 1972 169.57
31-Jul-2013 01:15:00 1972 169.56
% Calculate & Add 'Log Return' Variable To 'TT2' —
LogRet(1) = NaN;
for k = 2:size(TT2,1)
LogRet(k,:) = log(TT2.price(k)/TT2.price(k-1));
end
TT2 = addvars(TT2, LogRet)
TT2 = 79×3 timetable
time serial price LogRet
____________________ ______ ______ ___________
31-Jul-2013 00:00:00 1972 168.96 NaN
31-Jul-2013 00:05:00 1972 169.19 0.0013603
31-Jul-2013 00:10:00 1972 169.11 -0.00048774
31-Jul-2013 00:15:00 1972 169.04 -0.00039923
31-Jul-2013 00:20:00 1972 169.19 0.00088697
31-Jul-2013 00:25:00 1972 169.05 -0.00082781
31-Jul-2013 00:30:00 1972 169.14 0.00053225
31-Jul-2013 00:35:00 1972 169.09 -0.00028087
31-Jul-2013 00:40:00 1972 169.04 -0.00031053
31-Jul-2013 00:45:00 1972 169.06 0.00011091
31-Jul-2013 00:50:00 1972 169.13 0.00042136
31-Jul-2013 00:55:00 1972 169.11 -0.00014191
31-Jul-2013 01:00:00 1972 169.45 0.0020322
31-Jul-2013 01:05:00 1972 169.41 -0.00023609
31-Jul-2013 01:10:00 1972 169.57 0.00094401
31-Jul-2013 01:15:00 1972 169.56 -2.9487e-05
TT2(end-4:end,:)
ans = 5×3 timetable
time serial price LogRet
____________________ ______ ______ ___________
31-Jul-2013 06:10:00 1972 169.12 1.971e-05
31-Jul-2013 06:15:00 1972 168.85 -0.0015978
31-Jul-2013 06:20:00 1972 168.7 -0.00088876
31-Jul-2013 06:25:00 1972 168.51 -0.0011269
31-Jul-2013 06:30:00 1972 168.65 0.00083047
% --------------------------------------------------------------------------------
T3 = readtable('Result.txt') % Second File
T3 = 865×4 table
Var1 Var2 Var3 Var4
________________ _____________ ____ ______
{''03-Jan-2005'} {'00:00:00''} 1 121.56
{''03-Jan-2005'} {'00:05:00''} 1 121.64
{''03-Jan-2005'} {'00:10:00''} 1 121.69
{''03-Jan-2005'} {'00:15:00''} 1 121.65
{''03-Jan-2005'} {'00:20:00''} 1 121.65
{''03-Jan-2005'} {'00:25:00''} 1 121.51
{''03-Jan-2005'} {'00:30:00''} 1 121.51
{''03-Jan-2005'} {'00:35:00''} 1 121.29
{''03-Jan-2005'} {'00:40:00''} 1 121.18
{''03-Jan-2005'} {'00:45:00''} 1 121.15
{''03-Jan-2005'} {'00:50:00''} 1 120.99
{''03-Jan-2005'} {'00:55:00''} 1 120.98
{''03-Jan-2005'} {'01:00:00''} 1 120.98
{''03-Jan-2005'} {'01:05:00''} 1 120.92
{''03-Jan-2005'} {'01:10:00''} 1 120.82
{''03-Jan-2005'} {'01:15:00''} 1 120.8
T3(end-4:end,:)
ans = 5×4 table
Var1 Var2 Var3 Var4
________________ _____________ ______ ______
{''05-Jan-2005'} {'23:40:00''} 3.9809 118.44
{''05-Jan-2005'} {'23:45:00''} 3.9857 118.44
{''05-Jan-2005'} {'23:50:00''} 3.9904 118.44
{''05-Jan-2005'} {'23:55:00''} 3.9952 118.44
{''06-Jan-2005'} {'00:00:00''} 3.9999 118.44
Time = datetime(T3.Var1, 'InputFormat','''''dd-MMM-yyyy') + timeofday(datetime(T3.Var2,'InputFormat','HH:mm:ss'''''));
T3 = removevars(T3,[1 2]);
T3 = addvars(T3, Time,'Before','Var3')
T3 = 865×3 table
Time Var3 Var4
____________________ ____ ______
03-Jan-2005 00:00:00 1 121.56
03-Jan-2005 00:05:00 1 121.64
03-Jan-2005 00:10:00 1 121.69
03-Jan-2005 00:15:00 1 121.65
03-Jan-2005 00:20:00 1 121.65
03-Jan-2005 00:25:00 1 121.51
03-Jan-2005 00:30:00 1 121.51
03-Jan-2005 00:35:00 1 121.29
03-Jan-2005 00:40:00 1 121.18
03-Jan-2005 00:45:00 1 121.15
03-Jan-2005 00:50:00 1 120.99
03-Jan-2005 00:55:00 1 120.98
03-Jan-2005 01:00:00 1 120.98
03-Jan-2005 01:05:00 1 120.92
03-Jan-2005 01:10:00 1 120.82
03-Jan-2005 01:15:00 1 120.8
T3(end-4:end,:)
ans = 5×3 table
Time Var3 Var4
____________________ ______ ______
05-Jan-2005 23:40:00 3.9809 118.44
05-Jan-2005 23:45:00 3.9857 118.44
05-Jan-2005 23:50:00 3.9904 118.44
05-Jan-2005 23:55:00 3.9952 118.44
06-Jan-2005 00:00:00 3.9999 118.44
% --------------------------------------------------------------------------------
T3 = readtable('after the last code.txt')
T3 = 2880×4 table
Var1 Var2 Var3 Var4
________________ _____________ ____ ______
{''03-Jan-2005'} {'00:00:00''} 1 121.56
{''03-Jan-2005'} {'00:05:00''} 1 121.64
{''03-Jan-2005'} {'00:10:00''} 1 121.69
{''03-Jan-2005'} {'00:15:00''} 1 121.65
{''03-Jan-2005'} {'00:20:00''} 1 121.65
{''03-Jan-2005'} {'00:25:00''} 1 121.51
{''03-Jan-2005'} {'00:30:00''} 1 121.51
{''03-Jan-2005'} {'00:35:00''} 1 121.29
{''03-Jan-2005'} {'00:40:00''} 1 121.18
{''03-Jan-2005'} {'00:45:00''} 1 121.15
{''03-Jan-2005'} {'00:50:00''} 1 120.99
{''03-Jan-2005'} {'00:55:00''} 1 120.98
{''03-Jan-2005'} {'01:00:00''} 1 120.98
{''03-Jan-2005'} {'01:05:00''} 1 120.92
{''03-Jan-2005'} {'01:10:00''} 1 120.82
{''03-Jan-2005'} {'01:15:00''} 1 120.8
T4 = readtable('after the last code.txt')
T4 = 2880×4 table
Var1 Var2 Var3 Var4
________________ _____________ ____ ______
{''03-Jan-2005'} {'00:00:00''} 1 121.56
{''03-Jan-2005'} {'00:05:00''} 1 121.64
{''03-Jan-2005'} {'00:10:00''} 1 121.69
{''03-Jan-2005'} {'00:15:00''} 1 121.65
{''03-Jan-2005'} {'00:20:00''} 1 121.65
{''03-Jan-2005'} {'00:25:00''} 1 121.51
{''03-Jan-2005'} {'00:30:00''} 1 121.51
{''03-Jan-2005'} {'00:35:00''} 1 121.29
{''03-Jan-2005'} {'00:40:00''} 1 121.18
{''03-Jan-2005'} {'00:45:00''} 1 121.15
{''03-Jan-2005'} {'00:50:00''} 1 120.99
{''03-Jan-2005'} {'00:55:00''} 1 120.98
{''03-Jan-2005'} {'01:00:00''} 1 120.98
{''03-Jan-2005'} {'01:05:00''} 1 120.92
{''03-Jan-2005'} {'01:10:00''} 1 120.82
{''03-Jan-2005'} {'01:15:00''} 1 120.8
Do the same thing with other files, if desired.
.
Thanks for the code and your efforts. I really appreciate it. For the interpolation, as I want to use the last tick interpolation. In other words, if the price at second 600 is not available, we can use the price at second 595 not 602. This what I want to get in the interpolation. I'm not sure whether the "linear" do this or not. Also these should be separated among serial numbers. prices for serial number 2 separte from serial number 1 and so on.
Star Strider
2023 年 10 月 28 日
I am now completely lost.
I will delete my Answers in a few hours.
Emad
2023 年 10 月 28 日
I really benefit from your codes, you nearly right in most of it. What I want to check, is the interpolation method, as I want to get the last tick. I explain it in the previous replay.
Star Strider
2023 年 10 月 29 日
Thank you!
The last tick would be:
Last = T2(end,:)
or:
Last = TT2(end,:)
depending on what you want.
The same approach works for any of the other table or timetable arrays.
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Multirate Signal Processing についてさらに検索
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
