function tabinfig(fnum,dat0,columnname)
% puts the table (cell) dat into axis fnum [from gca] with columnname as header
% f = figure(fnum);
% set(f,'Position',[500 500 300 150]);
pos=get(fnum,'position');%[0.05 0.05 0.755 0.87]
dat=cell(size(dat0{:,1},1),size(dat0,2));
for jj=1:size(dat0,2);
    tmp=dat0{:,jj};
    for kk=1:size(tmp,1);
        dat{kk,jj}=char(tmp(kk,:));
    end
end
% dat =  {'        a', 1, '        units';...
%         '        b', 2, '        units';...   
%         '        c', 3, '        units';...
%         '        d',  4, '        units';...
%         '        e', 5, '        units';...
%         '        f', 6, '        units';};
% columnname =   {'Parameter', 'Value', 'Units'};
columnformat = {'char'}; 
for jj=1:size(dat,2)
columnformat{1,jj} = {'char'};
end
t = uitable('Units','normalized','Position',...
            pos, 'Data', dat,... 
            'ColumnName', columnname,...
            'ColumnFormat', columnformat,...
            'RowName',[]); 
        axis off
        set(gcf,'Color',[1,1,1]);