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

3 views (last 30 days)
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!

Answers (1)

Hayden Raabe-Garmon
Hayden Raabe-Garmon on 16 Mar 2023
% 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))

Categories

Find more on Tables in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!