%CONVERT1	Exemplifies conversions from numerical-to-cell-array and back

% Converto from numerical to cell array
format compact
diary convert1.dia
A  = [ 1 2; 3 4; 5 6 ]
A1 = num2cell(A)
celldisp(A1)
A2 = num2cell(A, 1)
celldisp(A2)
A3 = num2cell(A, 2)
disp('See now')
A3{:}
celldisp(A3)

% graphic display
subplot(1, 3, 1)
	cellplot(A1)
	axis off
	title('A1')
subplot(1, 3, 2)
	cellplot(A2)
	title('A2')
subplot(1, 3, 3)
	cellplot(A3)
	title('A3')
	
% print -deps num_cell.eps	
	
% Convert back, that is cell array of numbers to numerical array
Ac1    = zeros(size(A1));
Ac1(:) = [ A1{:} ]
Ac2    = zeros(size(A2));
Ac2    = cat(2, A2{:})
Ac3    = zeros(size(A3));
Ac3    = cat(1, A3{:})

diary off