finding sub sequences of a data set
11 views (last 30 days)
ts = xlsread('SwedishLeaf_TRAIN.xlsx');
for i = 1:500
for ii = 1:129
subSequence(ii,:) = p((ii-1)*30+ 1:ii*30);
I used the above code for finding the subsequences,but it not working.How can I find the subsequence of this.
Ajay Pattassery on 11 Nov 2019
I assume you want to extract a sub-vector of length 30 from each row. But the total length of the column is 129 which is not divisible by 30. Hence the 5th sub-vector will take 21 elements from the second row and it goes on.
subsequence = (reshape(ts',30,))'
If you have a constraint to keep the column length 129 and wish to have sub-parts elements from the same row together, you could split the matrix into two parts. One exactly divisible by 30.
ts1 = ts(:,1:120);
Subsequence1 = (reshape(ts1',30,))';
Subsequence2 = ts(:,121:end);
Here Subsequence1 will be 2000x30 and Subsequence2 will have the remaining elements of each row.