Excellent function, although I seem to have a problem with extra invalid characters that latex complains about in the place of empty cells. Has anybody else seen this?
I may suggest following changes to add 'p{}' alignment:
Lines 73-87:
case 3 % alignment
alignment = lower(pval);
if (strcmpi(alignment, 'right'))
alignment = 'r';
end
if (strcmpi(alignment, 'left'))
alignment = 'l';
end
if (strcmpi(alignment, 'center'))
alignment = 'c';
end
if (strcmpi(alignment, 'l')) && (strcmpi(alignment, 'r')) && (strcmpi(alignment, 'c')) && ~(strfind(alignment, 'p{'))
alignment = 'l';
warning('matrix2latex: ', 'Unkown alignment. (Set it to \''left\''.)');
end