The function table2latex(T, filename) formats a MATLAB table (T) into a .tex file (specified by the filename path), following the LaTeX formatting. Please, avoid using cells or structs inside the table.
Víctor Martínez-Cagigal (2019). MATLAB Table to LaTeX conversor (https://www.mathworks.com/matlabcentral/fileexchange/69063-matlab-table-to-latex-conversor), MATLAB Central File Exchange. Retrieved .
1.1.4 | Infinite values are now supported. |
|
1.1.3 | . |
|
1.1.2 | Error detection. |
|
1.1.1 | Grammar. |
|
1.1.0 | Function now supports tables with RowNames. |
Create scripts with code, output, and formatted text in a single executable document.
Gaston Fermandois Cornejo (view profile)
Hi Victor, I added the following lines to include variable units on the header of the LaTeX table:
% Parameters
unit_names = strjoin(T.Properties.VariableUnits, ' & ');
% Writing header
% Writing header
fileID = fopen(filename, 'w');
fprintf(fileID, '\\begin{tabular}{%s}\n', col_spec);
fprintf(fileID, '%s \\\\ \n', col_names);
fprintf(fileID, '%s \\\\ \n', unit_names);
fprintf(fileID, '\\hline \n');
Hope this code will be of use, and can be pulled to a next revision of the function.
Thanks!
-Gaston
Anastasia Kadochnikova (view profile)
Rui Coelho (view profile)
Fred Lima (view profile)
shdotcom shdotcom (view profile)
Thanks for sharing