Copyright Tristan Aubrey-Jones November 2006.
function mattotex(m)
% MATTOTEX Outputs a matrix in LaTeX tabular form
sz = size(m);
disp('\begin{tabular}{|');
for i = 1:sz(2)
disp('l|');
end
disp('}\hline');
for r = 1:sz(1)
for c = 1:sz(2) - 1
disp(sprintf('%s&', num2str(m(r,c))));
end
disp(sprintf('%s\\\\', num2str(m(r,sz(2)))));
%disp('\\');
end
disp('\hline');
disp('\end{tabular}');