rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
blowup_cell.m
1 function A=blowup_cell(A)
2 % function A=cell_blowup(A)
3 %
4 % function inserts a row and a column of empty cells between all rows and columns
5 % i.e. A={1,2;3,4} becomes A={1,[],2; [],[],[]; 3,[],4}
6 
7 [z,s]=size(A);
8 
9 % blow up rows
10 for i=1:z-1
11  A_up = A(1:(2*i-1),:);
12  A_down = A((2*i):end,:);
13  A=[A_up; cell(1,s);A_down];
14 end
15 
16 % blow up columns
17 for j=1:s-1
18  A_left = A(:,1:(2*j-1));
19  A_right = A(:,(2*j):end);
20  A=[A_left, cell(2*z-1,1), A_right];
21 end
22