1 function c=vec2cell(v,p)
3 % Reshape vector v into cell array of nd-arrays
4 % of the same sizes as the template p. The total number of entries
5 % in the vector v must equal to the total number of entries
21 c{i,j}=reshape(v(k+1:k+e),s);
26 error('incompatible vector and cell template')