ts_smoke.py runs
[wrf-fire-matlab.git] / quicwind / cell2vec.m
blobe1b0e6eebdcfe7d966396d038db467171b36c7dc
1 function v=cell2vec(c)
2 % v=cell2vec(c)
3 % Flatten a cell array of matrices to a vector
5 [m,n]=size(c);
6 v=[];
7 t=sum(sum(cellfun(@numel,c)));
8 v=zeros(t,1);
9 k=0;
10 for j=1:n
11     for i=1:m
12         s = size(c{i,j});
13         e = prod(s);
14         v(k+1:k+e)=reshape(c{i,j},[e,1]);
15         k=k+e;
16     end
17 end
18 if t~=k,
19     error('internal')
20 end
21 end