function append_mat, in1, in2
;
;
;assumes 2-dimensional
;        nx1 = nx2
;        both variables are the same data type
;
siz = size(in1)
nx1 = siz(1)
ny1 = siz(2)
;
siz = size(in2)
nx2 = siz(1)
ny2 = siz(2)
;
case siz(3) of
    1: begin		;byte type
	out = [byte(in1, 0, nx1*ny1), byte(in2, 0, nx2*ny2)]
	out = byte(out, 0, nx1, ny1+ny2)
       end
    2: begin		;integer*2 type
	out = [fix(in1, 0, nx1*ny1), fix(in2, 0, nx2*ny2)]
	out = fix(out, 0, nx1, ny1+ny2)
       end
    4: begin		;floating type
	out = [float(in1, 0, nx1*ny1), float(in2, 0, nx2*ny2)]
	out = float(out, 0, nx1, ny1+ny2)
       end
    3: begin		;integer*4 type
	out = [long(in1, 0, nx1*ny1), long(in2, 0, nx2*ny2)]
	out = long(out, 0, nx1, ny1+ny2)
       end
    5: begin		;real*8 type
	out = [double(in1, 0, nx1*ny1), double(in2, 0, nx2*ny2)]
	out = double(out, 0, nx1, ny1+ny2)
       end
endcase
;
return, out
end
