how to split a column matrix to sub matrix with specific type?

for this I have used nested for loop. still I was not successful. As I am a biginner for matlab I really need lot of help. If anyone can help, Please do this codeing. So far I could not able to find a tutorial for this problem.

 Accepted Answer

Let X be your column data and let k be your value.
% Arrange three time steps as moving window
X = rand(10,1) ;
k = 3 ;
idx = bsxfun(@plus, (1 : k), (0 : numel(X) - k).')';
iwant = X(idx)
iwant = 3×8
0.9752 0.1159 0.5926 0.0492 0.0715 0.8189 0.0654 0.8151 0.1159 0.5926 0.0492 0.0715 0.8189 0.0654 0.8151 0.4476 0.5926 0.0492 0.0715 0.8189 0.0654 0.8151 0.4476 0.4254

1 Comment

Thank you very much for your respod. this code is working properlly.

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!