MATLAB: Splitting up and N size array into parts

cell arrayssplit array

I basically have a number of matrixes (N,1) that i want to split up into smaller arrays. I want to split them into say 10 pieces irrelevant of the number of components. I tried using reshape but that has issues with prime numbers
How can i split an N length array into 10 other pieces and store as a cell?

Best Answer

N = 613;
P = 10;
X = rand(N, 1);
r = diff(fix(linspace(0, N, P+1)))
C = mat2cell(X, r, 1)