I want to extract data from one table and move into another from specific location in the first table.

2 次查看(过去 30 天)
I have created a code to compute the centered moving standard deviation of a data in a table, now I want to get the data starting from the 4th position to the last position with an increment of 5 between the positions.
I wrote a code which is extracting the st dev from the table and then I created a table of the length of the number of data points I want to extract from the second table, but when I tried to put it into the second table the out was just zeros.
Please help!
clear;
clc
close all;
T = readtable('NSEI1.csv');
Error using readtable
Unable to find or open 'NSEI1.csv'. Check the path and filename or file permissions.
T.Date = datetime(T.Date,'Format','dd-MM-uuuu');
M = movstd(T.Open,[3 1]);
g=length(M)
f=round((g/5))+1;
h = zeros(f,1);
for i=4:5:length(g)
h=[h;M(i)];
end
disp(h);
The output of this is just a table of zeros please help!

回答(1 个)

Hayden Raabe-Garmon
% M = movstd(T.Open,[3 1]);
M=[1:100] % just so I can test it without your CSV
g=length(M)
f=round((g/5))+1;
h=M(4:5:length(M))

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by