I have a question regarding vectors: I have a vector of size n and I want to split the vector by a matlab function so that I get elements 1-10, 2-11, 3-12….
Is there any built-in-function?
Thanks!
Best Answer
Split to one matrix:
n = 20;
% create vector a
a = 1:n;
m = cell2mat(arrayfun(@(x)a(x:x+9)',1:n-9,'UniformOutput',false));
Splitting to one matrix you can also perform with this code:
Best Answer