In Matlab, I want to sample data in such a way that to calculate the length of matrix, and for that, calculate its every 20th
row and stores in a array. That what I sampled my data.
length(P)
for instance which is 251
.
Now, I want to check if the Original P
index is equal to the sampled Matrix index (obviously the operation is in loop) then merge both same indexes, Which is:
[L]=[0];
for ii=1:length()
if P(ii,:)== SP{ii}(ii,:) %SP is sample points array
L = [P(ii,:)=; SP{ii}(ii,:);];
end
end
My Problem:
I'm unable to sample the data in my accordance, i.e SP= datasample(P,2);
and also, couldn't retrive the calculated L
very well, may be facing problem of indexes, i.e
if L~=0
l=L(ii,:);
end
Sample data after 20th iterations, can be simply in for-loop
instead of any built-in function, the code below showing some sketch for only one cell index.
kk = 0;
for ii=1:round(length(P{1})/30)
kk = kk+20;
L{ii} =P{1}(kk,:);
end